【发布时间】:2010-08-17 17:25:20
【问题描述】:
在我的 iphone 应用程序中,我试图让我的 uinavigationbar 充当一个按钮,我的意思是当我触摸它时做一些事情。不是任何导航项目的后退按钮,栏本身。 这是我如何“分类”它的:
@implementation UINavigationBar (UINavigationBarCategory)
- (void)drawRect:(CGRect)rect {
UIColor *color = [UIColor blackColor];
UIImage *img = [UIImage imageNamed: @"bar.png"];
[img drawInRect:CGRectMake(0, 0, self.frame.size.width, self.frame.size.height)];
self.tintColor = color;
}
该操作将导航到某个视图..
有什么想法吗?
提前致谢!
【问题讨论】:
-
我使用了一个类别,因为我认为我是实现 UINavigationBar 自定义的唯一方法。
标签: iphone cocoa-touch button uinavigationbar