解决方法
如果使用导航控制器,则可以使用自定义按钮并隐藏后退按钮.
要隐藏后退按钮使用此:
self.navigationItem.hidesBackButton = YES;
而对于自定义按钮:
UIButton * customButton = [UIButton buttonWithType:UIButtonTypeCustom]; [customButton setBackgroundColor:[UIColor colorWithRed:197.0/255.0 green:190.0/255.0 blue:157.0/255.0 alpha:1.0]]; [customButton setTitle:@"Do Something" forState:UIControlStatenormal]; customButton.titleLabel.font = [UIFont fontWithName:@"Helvetica-Bold" size:11.0f]; [customButton.layer setCornerRadius:3.0f]; [customButton.layer setMasksToBounds:YES]; [customButton.layer setBorderWidth:1.0f]; [customButton.layer setBorderColor: [[UIColor grayColor] CGColor]]; customButton.frame=CGRectMake(0.0,100.0,50.0,25.0); [customButton addTarget:self action:@selector(customMethod:) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem * customItem = [[UIBarButtonItem alloc] initWithCustomView:customButton]; customItem.tintColor=[UIColor blackColor]; self.navigationItem.leftBarButtonItem = customItem;
这对你有用.快乐的编码
原文地址:https://www.jb51.cc/iOS/330529.html
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。