Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

blackend.dk

macrumors newbie
Original poster
Jan 16, 2012
4
0
Hi

I have created a tab based application....

On tab 2 I have my settings. This includes selecting a picture shown on page 1.
When a new picture is selected on tab 2 I saved it in the nsdefaults.
When I go back to tab 1 I need this viewcontroller to load the new picture and put it in a Imageview.

How is this done the best. I cannot used Viewdidload or wievdidapper, as they are not "fired" going back to the view controller...

I have also tried to change the image in the Imageview from tab2 without any luck...

What do I do ?
 
viewWillAppear should be called.

Otherwise you can post a NSNotification when the user chooses an image and any interested class can observe that notification.
 
Accuracy is important in programming. Did you mean viewDidLoad and viewDidAppear?



As demo says, you must get the method signature exactly right or the system won't call your method.

The usual place to put cod to install data in a view controller's views is the viewWillAppear method. It's signature looks like this:



Code:
- (void)viewWillAppear:(BOOL)animated;


If you declare it like this (with no parameters) it won't get called:

Code:
- (void)viewWillAppear;

Or if you get the capitalization wrong:


Code:
- (void)viewwillappear:(BOOL)animated;
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.