我已经通过向其添加图像来定制我的导航控制器后退按钮,但我仍然无法将后退按钮返回到导航栏的左角。我想避免导航栏的左边距和后退按钮之间的间隙或空间。谢谢您的帮助。
问问题
1227 次
1 回答
1
这是您可以使用的代码
UIButton* backButton= [UIButton buttonWithType:UIButtonTypeCustom];
//here in below you just need to pass the point where you want to place your button.
正如你所说,你需要space between navigation bar's left margin and the back button.
[backButton setFrame:CGRectMake(xOrigin, yOrigin, width, height)];
[backButton setImage:[UIImage imageNamed:@"imageName.png"] forState:UIControlStateNormal];
UIBarButtonItem * leftBarButton =[[UIBarButtonItem alloc] initWithCustomView:backButton];
self.navigationItem.leftBarButtonItem= leftBarButton;
我希望它可以帮助你。
于 2012-11-15T17:08:05.873 回答