标签:
self.navigationItem.rightBarButtonItem=[[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"MoreImage"] style:UIBarButtonItemStylePlain target:self action:@selector(moreItemPress)];
用这种方法,设置的背景图片,颜色变掉了。不是原来设置的图片颜色。
可以用另外一种方式,可以解决变色的问题。
UIButton*rightButton = [[UIButton alloc]initWithFrame:CGRectMake(0,0,30,30)];
[rightButton setImage:[UIImage imageNamed:@"MoreImage"] forState:UIControlStateNormal];
[rightButton addTarget:self action:@selector(moreItemPress) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem*rightItem = [[UIBarButtonItem alloc]initWithCustomView:rightButton];
self.navigationItem.rightBarButtonItem= rightItem;
版权声明:本文为博主原创文章,未经博主允许不得转载。
navigationItem.rightBarButtonItem 设置背景图片,颜色更改解决办法
标签:
原文地址:http://blog.csdn.net/liuyinghui523/article/details/47833961