uinavigationitem

set custom back bar button universally with no title

不想你离开。 提交于 2019-11-30 15:47:05
问题 I want to set custom back bar button for all controllers in the app. I tried using this: [[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; It sets the image. That's OK. But, what i really want to do is that, i just want a custom button for back bar button which does not contain any title etc. The code above works, but it adds automated titles and resizes the back bar button item. My need is to have a fixed

set custom back bar button universally with no title

柔情痞子 提交于 2019-11-30 15:15:32
I want to set custom back bar button for all controllers in the app. I tried using this: [[UIBarButtonItem appearance] setBackButtonBackgroundImage:backButtonImage forState:UIControlStateNormal barMetrics:UIBarMetricsDefault]; It sets the image. That's OK. But, what i really want to do is that, i just want a custom button for back bar button which does not contain any title etc. The code above works, but it adds automated titles and resizes the back bar button item. My need is to have a fixed frame, no-title back bar button item for all controllers in the app. I've resolved it. Just make a

swift: setting back button image in nav bar

两盒软妹~` 提交于 2019-11-30 13:21:36
问题 I'm trying to set the back button image in nav bar in my controller, here's my code in viewDidLoad(): var backImg: UIImage? = UIImage(named: "back_btn.png") println(backImg) if var back_img = backImg { println("GET IT") println(back_img) println(UIControlState.Normal) println(UIBarMetrics.Default) self.navigationController.navigationBar.backItem.backBarButtonItem.setBackButtonBackgroundImage(back_img, forState: UIControlState.Normal, barMetrics: UIBarMetrics.Default) } I tried to put them to

UINavigationItem centering the title

爷,独闯天下 提交于 2019-11-30 10:41:36
问题 I have a navigationBar with both Left and Right bar buttons on each side. I have a customTitlelabel which I set as the titleView of the UINavigationItem . [self.navigationItem setTitleView:customTitleLabel]; All is fine now. The problem, the size of the rightbarButton is dynamic based on the input I get in one of the text fields. Therefore the title is automatically centered based on the available space between the buttons. how can i set the title to a fixed position? 回答1: You can't do what

Custom background for UINavigationBar problems

半世苍凉 提交于 2019-11-30 05:32:21
I've managed to add a custom background to my navigation bar by using: UIImageView *iv = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"UINavigationBar.png"]]; [myViewController.navigationBar insertSubview:iv atIndex:0]; [iv release]; This works fine and I can see the title and buttons okay. However, when I drill down one level and then go back to the root, the buttons are hidden, but the title is still visible. It appears the navigation bar image is covering the button items. I'm confused as I'm inserting it at the bottom so I would assume when the navigation items are pushed and

iPhone: UINavigationBar with buttons - adjust the height

廉价感情. 提交于 2019-11-30 05:21:05
I am working on an iPhone application which works in both orientations: portrait and landscape. I am using for one view and tableview embedded in an UINavigationController. The height of this navigationbar with its buttons is either: 44px portrait or 34px landscape. Within a different view I created the UINavigationBar by myself and I am able to set the frame for the correct size, but the embedded UINavigationItem with UIBarButtonItem doesn't shrink. So for the 34 px in the landscape mode this button is to big and overlaps the navbar in the height. The funny thing is though, that this worked

Simple Title not showing up in UINavigationController

偶尔善良 提交于 2019-11-30 05:08:47
问题 I have looked at all of the similar/related questions, but none either a) are exactly my problem or 2) the solutions just don't work. In my appDelegate.m I have in didFinishLaunchingWithOptions JCGRootNavigationController *rnc = [[JCGRootNavigationController alloc] init]; self.window.rootViewController = rnc;` JCGRootNavigationController is a subclass of UINavigationController @interface JCGRootNavigationController : UINavigationController` In JCGRootNavigationController.m: @implementation

UINavigationItem Prompt Issue

偶尔善良 提交于 2019-11-30 04:03:27
问题 I'm having a problem with the prompt on a UINavigationItem that I just can't resolve... I have a master and a detail view controller. When I push from the master to the detail a prompt is shown on the detail view controller: However, when I pop back to the master view controller, the view isn't resized and the window shows through (the window has been coloured red): This only happens on iOS7, on iOS6 the view resizes as expected. I've tried a few things such as setting the prompt to nil in

How can I get a full-sized UINavigationBar titleView

廉价感情. 提交于 2019-11-30 01:51:28
I am trying to add a custom control as the titleView in a UINavigationBar. When I do so, despite setting the frame and the properties that would normally assume full width, I get this: The bright blue can be ignored as it is where I am hiding my custom control. The issue is the narrow strips of navbar at the ends of the bar. How can I get rid of these so my customview will stretch 100%? CGRect frame = CGRectMake(self.view.bounds.origin.x, self.view.bounds.origin.y, self.view.width, kDefaultBarHeight); UANavBarControlView *control = [[[UANavBarControlView alloc] initWithFrame:frame] autorelease

Change Spacing Between UIBarButtonItems in iOS 8

邮差的信 提交于 2019-11-30 01:02:36
问题 I have a UINavigationItem on my view controller , and I am trying to reduce the spacing between my two RightBarButtonItems . Here is some of my code: // Create two UIBarButtonItems let item1:UIBarButtonItem = UIBarButtonItem(customView: view1) let item2:UIBarButtonItem = UIBarButtonItem(customView: view2) var fixedSpace:UIBarButtonItem = UIBarButtonItem(barButtonSystemItem: UIBarButtonSystemItem.FixedSpace, target: nil, action: nil) fixedSpace.width = -20.0 // Add the rightBarButtonItems on