使用相同的navigationcontroller为两个按钮设置导航标题

时间:2013-12-30 11:32:14

标签: objective-c xcode uinavigationcontroller uipopovercontroller

我想设置两个按钮的标题,在imagepickercontroller中,我已经在下面提供了我的代码。请告诉我任何想法或链接。

  - (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated 
{

  if ([settingsPopoverController isEqual:button])
  {

    UINavigationItem *ipcNavBarTopItem;


    UINavigationBar *bar = navigationController.navigationBar;
    [bar setHidden:NO];
    ipcNavBarTopItem = bar.topItem;
    ipcNavBarTopItem.title = @"Front Cover";

  }
   UINavigationItem *ipcNavBarTopItem;


 UINavigationBar *bar = navigationController.navigationBar;
[bar setHidden:NO];
ipcNavBarTopItem = bar.topItem;
ipcNavBarTopItem.title = @"Back Cover";
}

1 个答案:

答案 0 :(得分:2)

 - (void)navigationController:(UINavigationController *)navigationController     willShowViewController:(UIViewController *)viewController animated:(BOOL)animated 
 {

  if ([settingsPopoverController isEqual:button])
  {

 UINavigationItem *ipcNavBarTopItem;


UINavigationBar *bar = navigationController.navigationBar;
[bar setHidden:NO];
ipcNavBarTopItem = bar.topItem;
ipcNavBarTopItem.title = @"Front Cover";
return;

}
UINavigationItem *ipcNavBarTopItem;


UINavigationBar *bar = navigationController.navigationBar;
[bar setHidden:NO];
ipcNavBarTopItem = bar.topItem;
ipcNavBarTopItem.title = @"Back Cover";
 }