默认解决方案不合适:
最佳答案
这是创建自定义 leftBarButtonItem 的示例:
UIImage *buttonImage = [UIImage imageNamed:@"backbutton.png"];
UIButton *aButton = [UIbutton buttonWithType:UIButtonTypeCustom];
[aButton setImage:buttonImage forState:UIControlStateNormal];
aButton.frame = CGRectMake(0.0,0.0,buttonImage.size.width,buttonImage.size.height);
[aButton addTarget:self action:@selector(aSelector) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithCustomView:aButton];
self.navigationItem.leftButtonItem = backButton;
希望能帮助到你...
编辑:
试试这个...
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithImage:[UIImage imageNamed:@"yourimage.jpg"] style:UIBarButtonItemStyleBordered target:self action:@selector(aSelector)];
self.navigationItem.leftBarButtonItem = backButton;
我不记得backbutton是什么类型的按钮,尝试将默认样式更改为其他。祝你好运!
关于ios - 如何使 leftBarButtonItem 看起来像 backBarButtonItem?,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/7397911/