Reputation: 315
In my application, the data in the input fields across my views change constantly, so each time a view is brought onto the screen I need to run a function to sort what's displayed.
I found -(void)viewWillAppear, but this isn't being called when I press the "back" button which fires off my segue back from my NavController for some reason. I've read a few threads on this and it seems to me it's a bit ambiguous how it works internally.
How can I force a function to fire every time a view is brought on screen?
The code is basically as simple as
.h
@interface view1 : UIViewController
.m
// ... do stuff in viewDidLoad
// I added below, but the code never runs through it.
-(void)viewDidAppear
{
[self.view setNeedsDisplay];
}
Upvotes: 0
Views: 175
Reputation: 41652
Your method signature is wrong - the correct method is:
- (void)viewDidAppear:(BOOL)animated
You don't get any error as you can always define your own method, and its not like this is in a protocol.
Upvotes: 2