i can use
MyFirstAppDelegate *delegate = (MyFirstAppDelegate *)[[UIApplication sharedApplication] delegate];
[delegate.navigationController popViewControllerAnimated:YES];
or
[self.navigationController popViewControllerAnimated:YES];
So what is the difference between both ?
Please answer me ……
Thanks in advance..
You use the first form when you are accessing the navigation controller from an object that is not a view controller controlled by the navigation controller. That form accesses the navigation controller via the object that owns it i.e. the application delegate. Since the application delegate can be easily called from anywhere in the program, it is a good place to park things than any object might need a reference to.
You use the second form from an view controller that is controlled by the navigation controllers. It will only work from a view controller that has been previously pushed onto the stack.