Last active
December 15, 2015 04:39
-
-
Save lamprosg/5202874 to your computer and use it in GitHub Desktop.
(iOS) Backwards iteration. Check a property of a previous controller in the navigation hierarchy
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //Example | |
| //Pop views and return to mapresultsviewcontroller | |
| for(UIViewController *vc in [self.navigationController viewControllers]) { | |
| //MapAreaRsultsViewController is 2 controllers back in the hierarchy | |
| if([vc isMemberOfClass:[MapAreaResultsViewController class]]) { | |
| //Remove record from memory | |
| NSMutableArray *records; | |
| if (((MapAreaResultsViewController *)vc).resultsType == HOME_PAGE) { | |
| records = [[NSMutableArray alloc] initWithArray:Eng.search.resultsHome]; | |
| } else if (((MapAreaResultsViewController *)vc).resultsType == PROFILE_PAGE) { | |
| records = [[NSMutableArray alloc] initWithArray:Eng.search.resultsProfile]; | |
| } else { | |
| records = [[NSMutableArray alloc] initWithArray:Eng.search.resultsSearch]; | |
| } | |
| [records removeObject:Eng.details.record]; | |
| [((MapAreaResultsViewController *)vc) reloadViewData]; | |
| [self.navigationController popToViewController:vc animated:YES]; | |
| return; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment