码迷,mamicode.com
首页 > 移动开发 > 详细

IOS navigationItem 设置返回按钮,title图片和rightBarButtonItem

时间:2015-08-19 16:56:45      阅读:226      评论:0      收藏:0      [点我收藏+]

标签:

1.自定义返回按钮


    UIBarButtonItem *backItem = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStyleBordered target:nil action:nil];

    [self.moreItem setBackgroundImage:[UIImage new] forState:UIControlStateNormal barMetrics:UIBarMetricsDefault];

    [self.navigationItem setBackBarButtonItem:backItem];


    若想使返回按钮不可用
          self.navigationItem.leftBarButtonItem = nil;

2.设置标题图片

 self.navigationItem.titleView = [[UIImageViewalloc] initWithImage: [[UIImageimageNamed:@"barLogo.png"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]];


3.设置rightBarButtonItem

self.navigationItem.rightBarButtonItem=[[UIBarButtonItemalloc] initWithImage:[UIImageimageNamed:@"MoreImage.png"]style:UIBarButtonItemStylePlaintarget:selfaction:@selector(rightItemPress)];

若想使rightBarButtonItem不可用
          self.navigationItem.rightBarButtonItemnil;

版权声明:本文为博主原创文章,未经博主允许不得转载。

IOS navigationItem 设置返回按钮,title图片和rightBarButtonItem

标签:

原文地址:http://blog.csdn.net/liuyinghui523/article/details/47781155

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!