Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Trigger events when switching views
- secondView *secondViewController;
- secondViewController = [[SecondView alloc]
- initWithNibName:@"SecondView" bundle:nil];
- [self.view addSubview:SecondViewController.view];
- [self.view removeFromSuperView];
- [self.navigationController pushViewController:secondViewController animated:YES];
- - (void) backButtonClicked:(id)sender {
- [self.view removeFromSuperView];
- [[NSNotificationCenter defaultCenter] postNotificationName:@"back"
- object:self.view];
- }
- - (void) pushSecondViewController {
- [[NSNotificationCenter defaultCenter] addObserver:self
- selector:@selector(secondViewDidGoBack:)
- name:@"back"
- object:secondViewController.view];
- SecondView *secondViewController = [[SecondView alloc] initWithNibName:@"SecondView"
- bundle:nil];
- [self.view addSubview:secondViewController.view];
- }
- - (void) secondViewDidGoBack:(NSNotification *)notification {
- [[NSNotificationCenter defaultCenter] removeObserver:self];
- NSLog(@"My Second View Did Go back !");
- }
Advertisement
Add Comment
Please, Sign In to add comment