I have implemented a UIModalPresentationFormSheet in my iPad application. The new view partially covers the sub view and allows the user to make a choice. This all works great, however...
When the user selects an option I would like to update the underlying view with the new details, but cannot get it to work!
I have tried using setNeedsDisplay or [table reloadData]; in both the viewDidAppear and viewWillAppear methods.
Some code for codes sake:
- (void)viewWillAppear:(BOOL)animated {
[self updateUserDetails];
[self.myTableView reloadData];
}
- (void)viewDidAppear:(BOOL)animated {
[self updateUserDetails];
[self.myTableView reloadData];
}
- (void)updateUserDetails {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
[defaults setObject:selection forKey:@"userDetail"];
}
My transition is as follows. If this line is commented out then the application functions as expected:
myNavigationController.modalPresentationStyle = UIModalPresentationFormSheet;
Any help appreciated, thanks!
I think you should put the reloading of data near the code where you detect the selection of the user, not in the
viewWillAppear
ofviewDidAppear
.