stoutyhk
stoutyhk

Reputation: 243

reload/refresh button to refresh objects/data in a UIView

I have a UIView that updates based on data in a certain object.

I'd like to be able to add a refresh button to my toolbar that reloads the object and redraws the view. I don't want it to happen every time so don't want to use viewWillAppear:

Sounds like it should be a popular thing to do but I can't seem to find any answers on here or the web.

Thanks in advance.

Upvotes: 2

Views: 3414

Answers (1)

Rob Napier
Rob Napier

Reputation: 299355

If your underlying data has changed and the view needs to be redrawn to reflect this, send the view -setNeedsDisplay, or -setNeedsDisplayInRect: if you only need to update a part of the view.

Upvotes: 3

Related Questions