I am new in ios development. I want to develop custom navigation button method.
-(void) handleNext:(id)sender
{
MRGAppDelegate *appDelegate = (MRGAppDelegate*)
[[UIApplication sharedApplication]delegate];
[appDelegate.viewController GotoDirectoryView:self.restListViewController calledView:self.view];
}
in MRGViewController.m
-(void) GoToDirectoryView:(RestaurantListViewController*) resViewContrller calledView:(UIView*)viewControllerView
{
self.resListViewController = resViewController;
[resViewController release];
[viewControllerView removeFromSuperview];
[self.resListViewController viewDidLoad];
[self.view addSubview:self.resListViewController.view];
}
But Don’t call to RestaurantListViewController viewDidLoad don’t call. No error appear. I don’t know why? Please help me.
viewDidLoad,viewWillAppearetc are view controller life cycle method, these are called automatically when view is loaded on navigation stack. You won’t need to call these method at all.Currently you are simply adding a view on existing view controller, while you need to load a new view controller if you want view controller life cycle methods to get called.
Use like –
EDIT 1 –