English 中文(简体)
保持右堡的可见度?
原标题:Maintaining visibility of rightbarButton?

Hello朋友 我添加了<代码>UIImageView和:BarButtonItem,Navigationbar,载于rootViewController,点击BarButten。 主计长。 每一件工作都是罚款的,但一看一看一看一看一看二读。 看不见。 任何人都可以告诉我如何解决这一问题。

nav = [[UINavigationController alloc] init];
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, nav.navigationBar.frame.size.width, nav.navigationBar.frame.size.height)];
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
    UIImage *navImage = [UIImage imageNamed:@"NavBar-iPad.png"];
    imageView.image = navImage;
}
else
{
    UIImage *navImage = [UIImage imageNamed:@"NavBar-iPhone.png"];
    imageView.image = navImage;
}

[nav.navigationBar addSubview:imageView];
[imageView release];

[nav pushViewController:viewController animated:YES];
问题回答

I think you are trying to add a custom background to UInavigationBar. Try This Link to add Custom Background Image in iOS 5

The reason it disappears is that every UIViewController has it s own set of buttons/titles to display on the Navigation Bar. So when you push a new view, it automatically hides the buttons/title of the one below.

If you want buttons that look the same, you have to recreate them in the new UIViewController.

If you need EXACTLY those buttons, instead of pushing a new view controller like you are now, you can do this:

UINavigationController * navcontrol = [[UINavigationController alloc] initWithRootViewController: viewcontroller];
[navcontrol setNavigationBarHidden: YES];
[self.navigationController pushViewController: navcontrol animated:YES];
[navcontrol release];
[viewcontroller release];




相关问题
Code sign Error

I have created a new iPhone application.I have two mach machines. I have created the certificate for running application in iPhone in one mac. Can I use the other mac for running the application in ...

ABPersonViewController Usage for displaying contact

Created a View based Project and added a contact to the AddressBook using ABAddressBookRef,ABRecordRef now i wanted to display the added contact ABPersonViewController is the method but how to use in ...

将音频Clips从Peter改为服务器

我不禁要问,那里是否有任何实例表明从Peit向服务器发送音响。 I m不关心电话或SIP风格的解决办法,只是一个简单的袖珍流程......

• 如何将搜查线重新定位?

我正试图把图像放在搜索条左边。 但是,问题始于这里,搜索条线不能重新布署。