这看起来像一个非常简单的问题但我不知道错误在哪里。我有一个导航栏我正在放置一个自定义导航栏后退按钮该操作是通过“粉红色”颜色执行的,如下图所示
我的代码如下:
//-------back button start
UIImage *myImage1 = [UIImage imageNamed:@"Back.png"];
UIButton *myButton1 = [UIButton buttonWithType:UIButtonTypeCustom];
[myButton1 setImage:myImage1 forState:UIControlStateNormal];
myButton1.showsTouchWhenHighlighted = YES;
myButton1.frame = CGRectMake(0.0, 3.0, 40,30);
[myButton1 addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *leftButton = [[UIBarButtonItem alloc] initWithCustomView:myButton1];
self.navigationItem.leftBarButtonItem = leftButton;
//-------back button end
我什至尝试过这种方式,例如“myButton1.frame = CGRectMake(0.0, 3.0, 20,30);”
即使我也尝试更改按钮的宽度和高度。然后它只是减少后退按钮的宽度。
提前致谢