
self.navigationItem.backbarbuttonItem = yourCustomBackbutton;
我的问题是:如何创建一个后退按钮,其中考虑了色调,看起来与默认后退按钮完全相同,除了文本的颜色(除非是白色)?
解决方法 将类别添加到UINavigationbar并在其中设置它的背景颜色.此代码还说明了如何使用图像.@implementation UINavigationbar (UINavigationbarcategory)- (voID)drawRect:(CGRect)rect {/*** // use a custom color UIcolor *color = [UIcolor colorWithRed:.455 green:.365 blue:0 Alpha:.9]; 3 CGContextRef context = UIGraphicsGetCurrentContext(); 4 CGContextSetFillcolor(context,CGcolorGetComponents( [color CGcolor])); 5 CGContextFillRect(context,rect); 6 self.tintcolor = color; ***/// use a custom background imageUIImage *img = [UIImage image@R_301_6889@d: [Plistvariables sharedInstance].navbarBackgroundImage@R_301_6889@ ];[img drawInRect:CGRectMake(0,self.frame.size.wIDth,self.frame.size.height)];self.tintcolor = [Plistvariables sharedInstance].navbarTintcolor; } 这是使用RGB 192,93,0作为背景棕色的一些示例输出:
总结以上是内存溢出为你收集整理的iPhone – 如何复制后退按钮?全部内容,希望文章能够帮你解决iPhone – 如何复制后退按钮?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)