uinavigationbar

iOS: Positioning navigation bar buttons within custom navigation bar

房东的猫 提交于 2019-11-29 06:29:24
I'm building an app with a custom navigation bar. After some research I decided to do this using a category on UINavigationBar. The navigation bar needs to be a bit larger than usual to accomodate a drop shadow. Here is the code: #import "UINavigationBar+CustomWithShadow.h" @implementation UINavigationBar (CustomWithShadow) - (void)drawRect:(CGRect)rect { // Change the tint color in order to change color of buttons UIColor *color = [UIColor colorWithHue:0.0 saturation:0.0 brightness:0.0 alpha:0.0]; self.tintColor = color; // Add a custom background image to the navigation bar UIImage *image =

How do I “legally” fade out the navigation bar in an app?

不羁岁月 提交于 2019-11-29 06:22:19
问题 It seems the only way to remove a navigation bar with animation is via it sliding upward. I want it to fade, like in Photos.app. It would be easiest to change the alpha, however Apple's guidelines state: Prior to iOS v5.0, when used in conjunction with a navigation controller, there are only a handful of direct customizations you can make to the navigation bar. Specifically, it is alright to modify the barStyle, tintColor, and translucent properties, but you must never directly change UIView

Changing navigation bar color while popping view controller

拟墨画扇 提交于 2019-11-29 06:13:57
问题 I have three view controllers. In the first view controller (FirstVC), the navigation bar's bar tint color is clearColor and the bar itself is translucent. When I click on something, I push to SecondVC where the navigation bar needs to be opaque. So I set the barTintColor to some color value and set isTranslucent to false. When I push to ThirdVC from SecondVC, the navigation bar again needs to be translucent. The issue arises when I pop the ThirdVC and go back to SecondVC. The navigation bar

UINavigationBar appearance refresh?

女生的网名这么多〃 提交于 2019-11-29 05:51:27
问题 In my iPad app I have an application settings view. One of the options lets the user switch interface color scheme. The settings view is loaded by segue to a separate view controller than my "main" app's window. When they pick a new color I switch the colorSchemeColor variable and do this: // set the colors and refresh the view [[UINavigationBar appearance] setBarTintColor:colorSchemeColor]; [[UIToolbar appearance] setBarTintColor:colorSchemeColor]; [[UITabBar appearance] setBarTintColor

set navigationBar background image in swift

被刻印的时光 ゝ 提交于 2019-11-29 05:49:49
Code below is not working for me, can anyone help to figure it out what is wrong? var image = UIImage(named: "10384605_10152519403846670_5189785375955620548_n.jpg") as UIImage self.navigationController.navigationBar.setBackgroundImage(image , forBarMetrics:UIBarMetrics) self.navigationController.navigationBar.setBackgroundImage(image, forBarMetrics: .Default) William In AppDelegate.swift func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool { // Override point for customization after application launch. //Image Background

Changing the text color of a navigation bar title when “prefersLargeTitles” is set to true

谁说我不能喝 提交于 2019-11-29 05:18:03
问题 I have a requirement in which I have to use a UINavigationBar with a red large title. Currently, I have the following code: func prepareNavigationController() { let navController = UINavigationController(rootViewController: self) navController.navigationBar.prefersLargeTitles = true navigationItem.searchController = UISearchController(searchResultsController: nil) navigationItem.hidesSearchBarWhenScrolling = false navController.navigationBar.titleTextAttributes = [NSAttributedStringKey

Make a custom back button for UINavigationController

余生颓废 提交于 2019-11-29 05:03:00
I'm developping an app for iOS 4.2+. I subclassed my UINavigationController to insert two UIImageView and make the navigation bar look custom. Everything is working great but I have a little problem. I created custom UIBarButtonItem and inside my view controllers i put them with : self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc]initWithCustomView:backButton]; It works too but the problem is that to make this work I need to call it from: - (void)viewDidAppear:(BOOL)animated ; So it only appears after the animation and I can see the non customized button 1 second before the

How to add custom view on right of navigation bar Swift?

非 Y 不嫁゛ 提交于 2019-11-29 04:59:26
I am trying to add a custom view on right of UINavigationBar . What I tried is the following, but the view is not showing up! Please help, thanks in advance! let viewOnrightButton = UIView(frame: CGRect(x: 2, y: 2, width: 60, height: 22)) // viewOnrightButton.frame = CGRectMake(2, 2, 60, 22) viewOnrightButton.layer.cornerRadius = 2 viewOnrightButton.backgroundColor = UIColor(red: 0.961, green: 0.827, blue: 0.239, alpha: 1.00) lblNumbersOfBanana.frame = CGRectMake(2, 1, viewOnrightButton.frame.width-20, 20) lblNumbersOfBanana.text = "001" var bananaImgView = UIImageView(frame: CGRect(x:

Navigationbar title and back button name are same?

六眼飞鱼酱① 提交于 2019-11-29 04:47:39
I created one title for navigationbar in my storyboard project ,but when I moved to next viewcontroller the back button shows the same name as my previous navigationbar(Main navigationbar) title.? Can i set separate title and back button names? I tried following code but its not working ? why? self.navigationItem.title=@"Recent Books"; self.navigationItem.backBarButtonItem.title=@"Back"; According to UINavigationItem Class Reference "When this navigation item is immediately below the top item in the stack, the navigation controller derives the back button for the navigation bar from this

How can we put two line in UIBarButtonItem in Navigation Bar

不想你离开。 提交于 2019-11-29 04:10:01
"Now Playing" is in One line in UIBarButtonItem. I have to put it in two lines, like "Now" is ay top and "Playing" is at bottom.I have written the following line of code:- UIBarButtonItem *flipButton = [[UIBarButtonItem alloc] initWithTitle:@"Now Playing" style:UIBarButtonItemStyleBordered target:self action:@selector(flipView)]; self.navigationItem.rightBarButtonItem = flipButton; So i want to pu line break in between "Now Playing". So please help me out. Yes you can. It is fairly simple to do. Create a multiline button and use that. The "trick" is to set the titleLabel numberOfLines property