Reputation: 535
I have a situation where i have to reload all subViews of my current view....I am adding all objects(like buttons, images ...etc) from interface builder.....
And i want to reset these subviews when user click on a button...
i tried [self.view setNeedsDisplay];
but it doesn't works.
Is there any simple way to do this...
Any suggestion?
Upvotes: 0
Views: 2790
Reputation: 21967
Reloading them sounds like the wrong thing to do. You can easily reset them to their default state programmatically by setting the various properties to your defaults. Once you do that I would probably just create the whole view and subviews programmatically without using IB. I do everything programmatically now and find it easier to maintain my code.
You could come up with a NIB based solution by putting all affected subviews within a parent UIView and load just that parent view from a NIB and then replace the parent UIView only but I don't recommend it. You need to able to set subview properties programmatically in viewDidLoad
anyway in case the view controller needs to unload/reload the view based on memory warnings.
Upvotes: 0
Reputation: 10344
May be this is helpful to you.
One way is create on UI method that set default or required value for required controllers. And call it on button event.
Upvotes: 0
Reputation: 199
I am not sure that what happening in your code but i guess You should add all subview programatically and refresh on button click event, or write code in viewDidAppear method.
Upvotes: 1