[英]iPhone - Change target or selector for Back Button on UINavigationController
[英]How to change back bar button's width of a UINavigationController in iPhone?
我有两个表视图控制器。 说出TableViewController1和TableViewController2 。
当有人单击TableViewController1的单元格时,我按下TableViewController2 。
我将TableViewController1的单击单元格的值设置为TableViewController2的后栏按钮的标题值。
根据TableViewController1单元格字符串的长度,后退按钮的长度也会改变。
可以固定后退按钮的宽度吗? 我真的需要这个,因为我想捕获TableViewController2导航栏的titleView的tap事件。
后退栏按钮的宽度会影响titleView的宽度。 所以我找不到titleView的边界。 还是有其他方法可以找到导航栏titleView的bounds值?
可以固定后退按钮的宽度吗?
据我了解,您无法编辑此按钮。
将其子类化是一种方法,或者您可能想从上一个viewController中截断标题。 另外,您可能希望用普通的UIBarButtonItem替换为:
- (void) viewDidLoad
{
[super viewDidLoad];
self.title = @”shortTitle.”;
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Back"
style:UIBarButtonItemStyleBordered
target:nil
action:nil];
self.navigationItem.backBarButtonItem = backButton;
[backButton release];
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.