如何在iOS中设置导航栏后退按钮的图像任何人都可以告诉我必须使用的图像的大小。
由于
答案 0 :(得分:2)
UIImage* image3 = [UIImage imageNamed:@"back_button.png"];
CGRect frameimg = CGRectMake(15,5, 25,25);
UIButton *someButton = [[UIButton alloc] initWithFrame:frameimg];
[someButton setBackgroundImage:image3 forState:UIControlStateNormal];
[someButton addTarget:self action:@selector(Back_btn:)
forControlEvents:UIControlEventTouchUpInside];
[someButton setShowsTouchWhenHighlighted:YES];
UIBarButtonItem *mailbutton =[[UIBarButtonItem alloc] initWithCustomView:someButton];
self.navigationItem.leftBarButtonItem =mailbutton;
[someButton release];
答案 1 :(得分:1)
如果您的应用针对iOS 7+并且您只想更改后退箭头,那么这可能是最快的解决方案:
self.navigationController.navigationBar.backIndicatorImage = [UIImage imageNamed:@"back.png"];
self.navigationController.navigationBar.backIndicatorTransitionMaskImage = [UIImage imageNamed:@"back.png"];
它取决于你的尺寸;虽然我不会比默认的背面图像小得多。
答案 2 :(得分:0)
将此用于您的要求...... self.navigationItem.backBarButtonItem = [UIBarButtonItem alloc] initWithImage:<#(UIImage *)#>式:其中#(UIBarButtonItemStyle)#>目标:其中#(ID)#>动作:其中#(SEL)#> 强>