I read the similar problems and solutions regarding this issue, but it didn’t help me. Let’s say, I’ve got 3 UIViewControlers app.
-
At view #2 I placed a picture (.png) red/green (on/off). An int getting retrieved from db, if 1=green else red. It works fine for me.
-
At view #3, I am using UISwitcher to switch the int to values 1 or 0. It also doing well.
The problem. When I am pushing back to view #2 from #3, the picture stays unchanged. And only after pushing to view #1 and back to view #2, I’m getting the image changed.
The data getting retrieved in - (void)viewDidLoad method.
What I tried to do meanwhile:
Have added method - (void)viewWillAppear:(BOOL)animated
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self.tableView reloadData];
}
Also I tried to call database method in - (void)viewWillAppear:(BOOL)animated.
Alas, it doesn’t help.
Thank you for reading this and helping me.
Make the view 2 register to get notification for int value changed..and in view 3 ..when you change int..post the notification using [NSNotification defaultcenter]
1) In viewDidLoad of View 2
2) In Dealloc of view 2
3) In view 3 ..when you change int after that put this line
In the end..intChanged method(in view 2) will be called when int value is changed in view 3 make sure you define a method intChanged in view 2