Ios 后退按钮don';无法在导航栏中更改颜色
抱歉英语不好:-(Ios 后退按钮don';无法在导航栏中更改颜色,ios,iphone,xcode,uinavigationcontroller,Ios,Iphone,Xcode,Uinavigationcontroller,抱歉英语不好:-( 这里我使用的是xcode 5和ios7,当按下ViewController后,无法更改back按钮中的颜色 - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { ListViewController *viewList = [[ListViewController alloc] initWithNibName:@“ListVie
这里我使用的是xcode 5和ios7,当按下ViewController后,无法更改back按钮中的颜色
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
ListViewController *viewList = [[ListViewController alloc] initWithNibName:@“ListViewController” bundle:nil];
[self.navigationController pushViewController: viewList animated:YES];
}
用户按下一个单元格,然后ListViewController将出现。在导航栏中,右栏按钮显示为粉红色。但在后栏按钮中未显示“更改颜色”。请参阅我在下面附加链接的屏幕截图
我们可以在导航栏中更改“后退”按钮的颜色吗?或者应该在“后退”按钮中添加图像吗?对于自定义的后退按钮,请尝试此操作
UIView *backBtnView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 70, 40)];
backBtnView.backgroundColor = [UIColor clearColor];
UIButton *backBtn=[UIButton buttonWithType:UIButtonTypeCustom];
[backBtn setBackgroundColor:[UIColor clearColor]];
[backBtn setImage:[UIImage imageNamed:@"back.png"] forState:UIControlStateNormal];
[backBtn addTarget:self action:@selector(backBtnClicked) forControlEvents:UIControlEventTouchUpInside];
[backBtn setFrame:CGRectMake(5, 5, 57, 30)];
[backBtnView addSubview:backBtn];
self.navigationItem.leftBarButtonItem=[[UIBarButtonItem alloc]initWithCustomView:backBtnView];
您不能更改
BackbarButtonim
的颜色,但可以更改其色调。请尝试将以下内容添加到您的应用程序代理中:
[[uibarbuttonite外观]setTintColour:pinkColour]
请小心,这将使您的条形按钮全部呈粉红色。要更改应用程序中的所有UIBarButtonims颜色,请在AppDelegate中的应用程序窗口上设置
tintColor
属性。例如
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window.tintColor = [UIColor blueColor]; // or set color as you want.
return YES;
}
试试看…快乐代码:-)此颜色是ios7默认颜色,您应该仅将其替换为图像。也可以在情节提要中设置此颜色。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
ListViewController *viewList = [[ListViewController alloc] initWithNibName:@“ListViewController” bundle:nil];
self.navigationController.navigationBar.tintColor=[UIColor readcolor]; //set color as you want…..
[self.navigationController pushViewController: viewList animated:YES];
}