This is my viewController.m file
- (IBAction)defaultAction:(id)sender {
SimpleViewController *simpleView = [[SimpleViewController alloc]init];
[self presentViewController:simpleView animated:YES completion:nil];
}
- (IBAction)flipAction:(id)sender {
SimpleViewController *simpleView = [[SimpleViewController alloc]init];
[simpleView setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];
[self presentViewController:simpleView animated:YES completion:nil];
}
- (IBAction)dissolveAction:(id)sender {
SimpleViewController *simpleView = [[SimpleViewController alloc]init];
[simpleView setModalTransitionStyle:UIModalTransitionStyleCrossDissolve];
[self presentViewController:simpleView animated:YES completion:nil];
}
- (IBAction)pageCurlAction:(id)sender {
self.callFromPageCurl = true;
SimpleViewController *simpleView = [[SimpleViewController alloc]init];
simpleView.delegate = self;
[simpleView setModalPresentationStyle:UIModalPresentationFullScreen];
[simpleView setModalTransitionStyle:UIModalTransitionStylePartialCurl];
[self presentViewController:simpleView animated:YES completion:nil];
}
- (IBAction)showWithDelegate:(id)sender {
self.callFromShowWithDelegate = true;
SimpleViewController *simpleView = [[SimpleViewController alloc]init];
simpleView.delegate = self;
[self presentViewController:simpleView animated:YES completion:nil];
}
- (void)didReceiveMessage:(NSString *)message{
self.myMessage.text = message;
}
- (void)viewWillAppear:(BOOL)animated{
self.callFromShowWithDelegate = false;
self.callFromPageCurl = false;
NSLog(@"Called first");
}
and this is my simpleViewController.m file
- (IBAction)dismissMeAction:(id)sender {
if(self.delegate.callFromShowWithDelegate)
[self.delegate didReceiveMessage:@"Hello World"];
else
[self.delegate didReceiveMessage:@"My Message"];
if(self.delegate.callFromPageCurl == true)
[self dismissViewControllerAnimated:NO completion:nil];
else
[self dismissViewControllerAnimated:YES completion:nil];
}
When i use pageCurl to go to the next view and i came back to the main view it is calling viewWillAppear method again But if i go to the next view using any other button and came back to the main view it is not calling viewWillAppear method.. But why? SHouldn't it have called viewWillAppear method every time i came back to main view.
