You can only have image or text inside the UIBarbuttonItem
, the < is added by iOS by default as a back button for the navigation hierarchy.
You have to design the < button in the image itself if you want both image and the < in the barButton.
質問
The iPhone's default calendar program shows the "<" and text at the same time in the navigator bar.
I want to have image and text simultaneously as well.
How is this implemented in Xcode?
解決 2
You can only have image or text inside the UIBarbuttonItem
, the < is added by iOS by default as a back button for the navigation hierarchy.
You have to design the < button in the image itself if you want both image and the < in the barButton.
他のヒント
Create a custom button
UIButton *barBt =[[UIButton alloc] initWithFrame:CGRectMake(0, 0, 60, 44)];
[barBt setImage:[UIImage imageNamed:@"my_image.png"] forState:UIControlStateNormal];
[barBt setTitle:@"MyTitle" forState:UIControlStateNormal];
[barBt addTarget:self action: @selector(pressed:) forControlEvents:UIControlEventTouchUpInside];
UIBarButtonItem *barItem = [[UIBarButtonItem alloc]init];
[barItem setCustomView:barBt];
self.navigationItem.leftBarButtonItem = barItem;