【发布时间】:2011-10-25 20:12:12
【问题描述】:
我正在编写自定义 UINavigationBar。由于该应用程序应该在 iOS 4 上运行,因此无法使用 new customization options available on iOS 5。
也就是说,我对 UINavigationBar 进行了子类化,以避免使用效果很好的类别,如下图所示。
UIBarButtonItems 不能正常工作。
我尝试继承 UIBarButtonItem 类并覆盖 drawRect 方法,但没有任何改变。
CustomUIBarButtonItem *backButton = [[CustomUIBarButtonItem alloc] initWithTitle:@"Notícias" style:UIBarButtonItemStylePlain target:nil action:nil];
self.navigationItem.backBarButtonItem = backButton;
[backButton release];
然后我也尝试设置下面的图像,但也没有用。
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"noticias_back.png"] style:UIBarButtonItemStyleBordered target:nil action:nil];
self.navigationItem.backBarButtonItem = backButton;
[backButton release];
那么,我该怎么做呢?
【问题讨论】:
-
你有想过这个吗?
标签: iphone cocoa-touch ios4