我通过向其添加图像自定义了我的导航 Controller 后退按钮,但我仍然无法将后退按钮置于导航栏的左角。我想避免导航栏的左边距和后退按钮之间的间隙或空间。 感谢您的帮助。
最佳答案
这是你可以使用的代码
UIButton* backButton= [UIButton buttonWithType:UIButtonTypeCustom];
//here in below you just need to pass the point where you want to place your 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;
希望对您有所帮助。
关于iphone - 如何在 iphone 应用程序中将导航 Controller 的后退按钮与其左角对齐,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13402395/