uinavigationbar

How to hide a navigation bar from first ViewController in Swift?

一个人想着一个人 提交于 2019-11-26 10:06:32
问题 How can I hide a navigation bar from first ViewController or a particular ViewController in swift? I used the following code in viewDidLoad() : override func viewDidLoad() { super.viewDidLoad() self.navigationController?.isNavigationBarHidden = true } and also on viewWillAppear : override func viewWillAppear(animated: Bool) { self.navigationController?.isNavigationBarHidden = true } Both methods hide the navigation controller from all ViewControllers. 回答1: If you know that all other views

How to set the text of a back button on a UINavigationBar? [duplicate]

回眸只為那壹抹淺笑 提交于 2019-11-26 09:34:33
问题 Possible Duplicate: How do I change the title of the “back” button on a Navigation Bar The Situation: I have a UIViewController that is governed by a navigation controller. I am able to set the title of the navigation bar covering the UIViewController by simply calling self.title = @\"title\" . But, I want to be able to set the back button text of the navigation bar, too (for different languages n\' such..) The Problem: I don\'t know how to set the back button\'s text. The Question: How do I

How to change UINavigationBar background color from the AppDelegate

假装没事ソ 提交于 2019-11-26 09:26:58
问题 I know how to change the UINavigationBar background image by doing [[UINavigationBar appearance] setBackgroundImage:[UIImage imageNamed:@\"nabbar\"] forBarMetrics:UIBarMetricsDefault]; and I know how to set the bar to different colors within each Views ..... Now I want to change the background color without using an image to a solid color from the app delegate . I do not want to set it each time from each view and I do not want to write a CGRect . I tried [[UINavigationBar appearance]

UINavigationBar multi-line title

自作多情 提交于 2019-11-26 09:22:35
问题 Is there a straightforward way of overriding the titleView of the current navigation bar item in a navigation bar within a navigation controller? I\'ve tried creating a new UIView and replacing the titleView property of topView with my own UIVIew with no success. Basically, I want a multi-line title for the navigation bar title. Any suggestions? 回答1: Set the titleView property of the UINavigationItem . For example, in the view controller's viewDidLoad method you could do something like:

How can I set the UINavigationbar with gradient color?

半城伤御伤魂 提交于 2019-11-26 09:20:15
问题 I want to set the UINavigationbar backgroundColor to a gradient color where I would like to set it via an array of colors to create a Gradient, ideally, as accessible methods inside UINavigationBar to change its color to this gradient. Any suggestions? (Aside from setting an image manually as the background image of the navigation bar) 回答1: Create gradient layer and add it as background of navigation bar. CAGradientLayer *gradient = [CAGradientLayer layer]; gradient.frame = self

iPhone - How set uinavigationbar height?

为君一笑 提交于 2019-11-26 09:07:51
问题 I want to make the top of the navigation view a bit smaller. How would you achieve this? This is what I\'ve tried so far, but as you can see, even though I make the navigationbar smaller, the area which it used to occupy is still there (black). [window addSubview:[navigationController view]]; navigationController.view.frame = CGRectMake(0, 100, 320, 280); navigationController.navigationBar.frame = CGRectMake(0, 0, 320, 20); navigationController.view.backgroundColor = [UIColor blackColor];

Get the right color in iOS7 translucent navigation bar

落爺英雄遲暮 提交于 2019-11-26 09:05:24
问题 How can I get the right coloring for my translucent navigation bars in iOS 7? The navigation bar just adjusts the given color to a much brighter one. Changing brightness or saturation of the color also doesn´t deliver the right result. Anyone having the same trouble? It seems to work somehow, looking at Facebook: they´re having their colors and translucent navigation bars. Edit: Just to make it clear: I need the Bar to be translucent, not transparent (with some alpha), not solid! http://en

Change position of UIBarButtonItem in UINavigationBar

筅森魡賤 提交于 2019-11-26 08:58:11
问题 How can I change the position of a UIBarButtonItem in a UINavigationBar? I would like my button to be about 5px higher than its normal position. 回答1: There is no particularly good way to do this. Your best bet if you really must is to subclass UINavigationBar, and override layoutSubviews to call [super layoutSubviews] and then find and reposition the button's view. 回答2: This code creates a back button for UINavigationBar with image background and custom position. The trick is to create an

Swift programmatically navigate to another view controller/scene

妖精的绣舞 提交于 2019-11-26 08:49:42
问题 I\'m using following code to programmatically navigate to another ViewController. It works fine, but it some how hides the navigation bar . How do I fix this? (the navigation bar is created by embeding the ViewController in the navigation controller if that matters.) let storyBoard : UIStoryboard = UIStoryboard(name: \"Main\", bundle:nil) let nextViewController = storyBoard.instantiateViewControllerWithIdentifier(\"nextView\") as NextViewController self.presentViewController

iOS 11 navigation bar height customizing

淺唱寂寞╮ 提交于 2019-11-26 08:43:57
问题 Now in iOS 11, the sizeThatFits method is not called from UINavigationBar subclasses. Changing the frame of UINavigationBar causes glitches and wrong insets. So, any ideas how to customize navbar height now? 回答1: According to Apple developers (look here, here and here), changing navigation bar height in iOS 11 is not supported. Here they suggest to do workarounds like having a view under the navigation bar (but outside of it) and then remove the nav bar border. As a result, you will have this