Adding BarButtonItem to a Modal Navigation View Controller?

Got the problem ... was adding rightBarButtonItem to navController's navigationItem ... I should be adding it to rootViewController's navigationItem in viewDidLoad.

Up vote 0 down vote favorite share g+ share fb share tw.

I am presenting a modal navigation bar controller initialized with a root controller (which is a UITableViewController). When I, initialize the UINavigationBarController to present it modally, I am also adding a "Submit" button as a right bar button item. Everything is working fine (loading with root view and Modal presentation) However, the right button is not showing.

Posting the code below - -(IBAction) presentAddLeaveRequestModally { AddLeaveRequestViewController *leaveRequestViewController = AddLeaveRequestViewController alloc init; UINavigationController *navController = UINavigationController alloc initWithRootViewController:leaveRequestViewController; UIBarButtonItem *submitButton = UIBarButtonItem alloc initWithTitle:@"Submit" style:UIBarButtonItemStyleBordered target:self action:@selector(submitLeaveRequest); navController.navigationItem. RightBarButtonItem = submitButton; self. HomeTabBarController presentModalViewController:navController animated:YES; } Any ideas if I am missing something obvious?

Uinavigationcontroller uibarbuttonitem modalviewcontroller link|improve this question asked Aug 31 '10 at 12:17Dev7921618 97% accept rate.

Got the problem ... was adding rightBarButtonItem to navController's navigationItem ... I should be adding it to rootViewController's navigationItem in viewDidLoad. UIBarButtonItem *submitButton = UIBarButtonItem alloc initWithTitle:@"Submit" style:UIBarButtonItemStyleBordered target:self action:@selector(submitLeaveRequest); self.navigationItem. RightBarButtonItem = submitButton.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions