10

我目前使用此代码来设置我的导航项的 titleView:

- (void)viewDidLoad 
{ ...
   UIImage *navbarTitle = [UIImage imageNamed:@"navbartitleview1"];
   UIImageView *imageView = [[UIImageView alloc]initWithImage:navbarTitle];
   self.navigationItem.titleView =imageView;
}

有没有办法可以使用 UIAppearance 放置此代码?

[UINavigationItem appearance]

无效。

4

1 回答 1

1

No you wan't be able to do that with UIAppearence, what you can is to have a UIViewController from where all the others UIViewController will inherit. Think way you avoid having to put that code in all your UIViewControllers.

于 2013-04-20T09:40:16.757 回答