backbarbuttonitem

Left bar button Item

◇◆丶佛笑我妖孽 提交于 2020-03-19 05:39:32
问题 so if you have a navigation controller with no bar button Items then a navigation back button will show up with the name of the last View Controller and I want to keep that, as in I don't want to have to hardCode it. and I do know how to add it in but I don't want to have to do that because that leaves more room for bugs. Is there a way that I can have a left bar button Item and the default one doesn't go away? 回答1: Add this in viewController where you want to have default back button and

Change colour of back bar button item only in swift

余生颓废 提交于 2020-01-01 21:59:23
问题 I am trying to change the colour of the back bar button item in swift navigation bar. Ultimately I aim to make something line this for the navbar: This is my current code which gives me three back arrows as the back button item but how do I change the colour so it is three different colours in one bit of text? (Green, Yellow, Red). func setCustomBackImage() { navigationItem.backBarButtonItem = UIBarButtonItem(title: "<<<", style: .plain, target: nil, action: nil) } 回答1: There is a much more

How to change back bar button's width of a UINavigationController in iPhone?

可紊 提交于 2019-12-24 07:17:21
问题 I have two table view controllers. Say TableViewController1 and TableViewController2 . I push TableViewController2 when someone clicks on the TableViewController1 's cell. I set the TableViewController1 's clicked cell's value as the TableViewController2 's back bar button's title value. According to the length of the TableViewController1 cell's string, the back bar button's length also get changing. Is it possible to fix the width of the back bar button? I really need this, because I want to

Change BackBarButtonItem for All UIViewControllers?

守給你的承諾、 提交于 2019-12-23 05:16:14
问题 I would like to change the BackBarButtonItem on all the views in my iOS app so that they show just the back arrow with no text. Is the only way to accomplish this is to go through every UIViewController and set the self.navigationItem.backBarButtonItem.title ? Seems I should be able to create a superclass to define the default value of backBarButtonItem.title , but I am not sure where to start. Thank you for your help. 回答1: You don't need to change it on every view controller class. You can

backBarButtonItem gets renamed in iOS 7 when there is a long title

☆樱花仙子☆ 提交于 2019-12-21 09:15:05
问题 One behavior I observed in iOS 7 is that the title of the backBarButtonItem of a UINavigationItem get's renamed if the title of the currently displayed view controller is too long. Too lazy to explain so here are some photos: As you can see, when the title is too long, the back button gets renamed to "Back" regardless of what it was previously. If the title is even longer, the back button doesn't show any text, just the left arrow image. Does anyone know how to disable this behavior? I would

BackBarButton won't display correct title

安稳与你 提交于 2019-12-12 01:45:35
问题 I am trying to set my backButton to a simple "<" like this: self.navigationItem.backBarButtonItem = UIBarButtonItem(title:"", style:.Plain, target:nil, action:nil) print(self.navigationItem.backBarButtonItem?.title) The printing will display "", but running my app on the simulator will always display the title of the previous VC. Though I tested navigationController?.navigationBar.tintColor = UIColor(red:0.60, green:0.60, blue:0.60, alpha:1.0) will change the button's color. Note: I am

backBarButtonItem doesn't call action

你。 提交于 2019-12-09 21:26:45
问题 I would like to call an action when my backButton is clicked but this doesn't seem to be it. viewDidLoad in rootViewController: self.navigationItem.backBarButtonItem = [[[UIBarButtonItem alloc] initWithTitle:@"Logout" style:UIBarButtonItemStyleDone target:self action:@selector(logout)] autorelease]; The title of it is correct but nothing happens. logout (in the rootViewController) header: -(void)logout; body: -(void)logout { NSLog(@"test"); [[User owner] logout]; } Could anyone tell me how to

how to change the color of backBarButtonItem?

给你一囗甜甜゛ 提交于 2019-12-06 04:12:53
问题 In my application I want to change the color of bacBarButtonItem. Is it possible to change the color? or I have to put an image of it. and in case of image tell me the code how to put the image. 回答1: UIImage *image = [UIImage imageNamed:@"imageName.png"]; UIBarButtonItem* backBarButton = [[UIBarButtonItem alloc] initWithImage:image style:UIBarButtonItemStylePlain target:self action:@selector(backButtonAction)]; self.navigationItem.leftBarButtonItem=backBarButton; [backBarButton release]; 回答2:

backBarButtonItem gets renamed in iOS 7 when there is a long title

倖福魔咒の 提交于 2019-12-04 03:05:43
One behavior I observed in iOS 7 is that the title of the backBarButtonItem of a UINavigationItem get's renamed if the title of the currently displayed view controller is too long. Too lazy to explain so here are some photos: As you can see, when the title is too long, the back button gets renamed to "Back" regardless of what it was previously. If the title is even longer, the back button doesn't show any text, just the left arrow image. Does anyone know how to disable this behavior? I would like the back button to stay exactly what I want it to be and not get renamed. Thanks EDIT I created a