它是一个非常基本的问题 - 但我无法在任何地方找到答案。 我想要一个后退按钮,就像在导航栏中显示的默认按钮,但在后台有一个图像。 即使进行自定义,如何根据标题计算按钮的大小/长度? 非常感谢您的帮助,提前!导航控制器中的后退按钮
UPDATE:
谢谢你们!但我终于实现了答案是这样的:
@implementation UINavigationBar的(UINavigationBarCategory)
- (空)的drawRect:(的CGRect)RECT
{
UIColor *color = [UIColor colorWithRed:(13.0/255.0) green:(183.0/255.0) blue:(255.0/255.0) alpha:1.0];
//使用自定义颜色的后退按钮,我在我的导航栏图像上使用数字颜色表:P
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColor(context, CGColorGetComponents([color CGColor]));
CGContextFillRect(context, rect);
self.tintColor = color;
// use a custom background image for my navigation bar
UIImage *img = [UIImage imageNamed: Navigation_img];
[img drawInRect:CGRectMake(0,0,img.size.width,img.size.height)];
} //令人满意的工作对我来说
@end
上面的答案只是将导航条中的默认后退按钮和背景图像的颜色合并到导航栏中。 – Prathiba