English 中文(简体)
iOS 5 - 1 不同于所有其他的自定义 UINAvigation 工具栏
原标题:iOS 5 - 1 Custom UINavigationBar different than all others

我正在使用 iOS 5 中的 UIAppearance 创建自定义 UINAvigation Bar。 我使用以下代码( 内侧 AppDelegate.m ) 来给所有导航杆以相同的背景 。

[[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@"NavBarNoText.png"] forBarMetrics:UIBarMetricsDefault];

我希望能够使用 1 navbar “ NavBarOinText.png ”, 仅用于 1 个表查看控制器, 而我使用 NavBarNoText. png 作为所有其他导航栏的背景, 除了上述表查看控制器。 有人知道这是否可能吗? 我知道Instagram 做了类似的事情, 而主标签使用不同的导航栏, 比所有其他标签都使用不同的导航栏 。

在ViewDid Load方法中,我尝试了在每一个不同的类中分别使用这个方法,但似乎没有效果。我第一次看到一个不同的背景,但当我切换一个视图后,它又回到了共同的背景。

-(void)viewDidLoad
{
[super viewDidLoad];
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"NavBarWithText.png"] forBarMetrics:UIBarMetricsDefault];
}

单一观点

-(void)viewDidLoad
{
[super viewDidLoad];
[self.navigationController.navigationBar setBackgroundImage:[UIImage imageNamed:@"NavBarNoText.png"] forBarMetrics:UIBarMetricsDefault];
}

所有其他观点。

最佳回答

您可以在 UITableViewCentrent 中显示不同的导航栏, 详情请见

问题回答

暂无回答




相关问题
List Contents of Directory in a UITableView

I am trying to list the contents of Ringtones directory in a TableView, however, I am only getting the last file in the directory in ALL cells, instead of file per cell. This is my code: - (...

iPhone NSUserDefaults persistance difficulty

In my app i have a bunch of data i store in the NSUserdefaults. This information consists of an NSObject (Object1) with NSStrings and NSNumbers and also 2 instances of yet another object (Object2). ...

Writing a masked image to disk as a PNG file

Basically I m downloading images off of a webserver and then caching them to the disk, but before I do so I want to mask them. I m using the masking code everyone seems to point at which can be found ...

Resize UIImage with aspect ratio?

I m using this code to resize an image on the iPhone: CGRect screenRect = CGRectMake(0, 0, 320.0, 480.0); UIGraphicsBeginImageContext(screenRect.size); [value drawInRect:screenRect blendMode:...

Allowing interaction with a UIView under another UIView

Is there a simple way of allowing interaction with a button in a UIView that lies under another UIView - where there are no actual objects from the top UIView on top of the button? For instance, ...

热门标签