uinavigationbar

Placing a custom view based UIBarButtonItem in the navigation bar without default horizontal padding

妖精的绣舞 提交于 2019-11-29 22:48:40
How do I remove the horizontal padding to the left and right of custom left and right UINavigationBar items? There seems to be ~ 10 points of padding that iOS sets by default. I'm customizing left and right navigation bar buttons (I have given up on trying to set my own backButtonItem, so I'm just using the leftBarButtonItem). In either case (left or right), pressing these custom buttons indicates that Apple seems to preserve some padding to the left of the leftBarButtonItem, and to the right of the rightBarButtonItem; regardless of how wide I make the custom background and image properties of

Set the title of Navigation Bar created in Interface Builder

让人想犯罪 __ 提交于 2019-11-29 22:48:23
I have a modal view controller whose view comes from a XIB. I want it to have the same look and feel as the rest of my navigation based app, but it's not a view that's pushed to the navigation stack, it's presented modally. I dragged a UINavigationBar in and made it an outlet, but it doesn't have a title property to set. I have two fields that can bring up this modal view, and I want the title set differently depending on which one creates the modal view. codelark UINavigationBar 's manage a stack of UINavigationItem s much like a UINavigationController manager a stack of UIViewController s.

UINavigationBar - Set title programmatically?

*爱你&永不变心* 提交于 2019-11-29 22:45:22
I have a tab bar application with a different view on each tab. Each view has a UINavigationBar with title set on Interface Builder. I want to change the title based on a clause in the ViewDidLoad method, so if x { change the title }. I have tried self.title = @"title" , but this changes the title of the tab bar item itself. So, how is this done? Greg I've set the title programmatically using code something like this: navBar.topItem.title = @"title"; where navBar is declared as an IBOutlet UINavigationBar linked to the navigation bar in interface builder. This worked in my app; however, I was

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

六月ゝ 毕业季﹏ 提交于 2019-11-29 22:40:33
问题 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

How do i change navigationBar font in Swift?

假装没事ソ 提交于 2019-11-29 22:13:00
How do I change the NavigationBar font in Swift? This is what I have tried so far, but receiving an error (I have correctly implemented CaviarDreams to the project): self.navigationController.navigationBar.titleTextAttributes = NSFontAttributeName[UIFont .fontWithName(CaviarDreams.ttf, size: 20)] Error says: Use of unresolved identifier 'CaviarDreams Sorry if the question is extremely bad. Jim T Try this: self.navigationController.navigationBar.titleTextAttributes = [ NSFontAttributeName: UIFont(name: "CaviarDreams", size: 20)!] Edit: Now, UIFont must be unwrapped to be able to be used here.

UINavigationBar change colors on push

試著忘記壹切 提交于 2019-11-29 21:36:32
I'm using 2 different bar tint colors at UINavigationBar in different views. I'n changing color with that method in both views: override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) self.navigationController?.navigationBar.barTintColor = COLOR } When I tap on back button color is not changed smoothly (you can see blink on last second). But everything is okay if just swipe view back instead of tapping on back button. How to make smooth transition in both situations? kamwysoc To achieve this kind of animation you should use UIViewControllerTransitionCoordinator as Apple

How to add image in UINavigationBar in IPhone app

↘锁芯ラ 提交于 2019-11-29 21:22:55
In my app, i want to add image(logo) in Navigation bar. I am working on XCode 4.2 and iOS 5. I know UINavigationBar , UIToolBar has been changed in iOS 5. So iOS 4.2 UINavigationBar code won't work in iOS 5. I want to support display image in UINavigationBar in both 4.2 and 5 version. I want to be display image in UINavigationBar like as in below screenshot. Please help in this regards and if there is any sample code means its very helpful to me. Thanks!!! One way to do this is to use UINavigationItem.titleView and UINavigationItem.rightBarButtonItem . Like this : viewController.navigationItem

Change the height of NavigationBar and UIBarButtonItem elements inside it in Cocoa Touch

喜夏-厌秋 提交于 2019-11-29 20:44:15
I suppose it's not strictly in line with Apple guidelines but I guess it must be possible somehow. I'd like to change the height of navigation bar inside UINavigationController and the height of UIBarButtonItem elements inside that bar. Using a trick from this question I managed to change the height of navigation bar but I can see no way of adjusting the height of bar button items. If anyone knows how to change the size of bar button items, please help me out. Maybe this tutorial about a customized navbar will help you: Recreating the iBooks wood themed navigation bar If you create a

custom background image with large titles NavigationBar in iOS 11

流过昼夜 提交于 2019-11-29 20:43:29
How do you set a custom background image for the large title NavigationBar in iOS 11? I'm using a custom subclass which I've assigned to the navigationControllers in the storyboard. This is how I create my custom NavBar: class CustomNavigationController: UINavigationController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. self.navigationBar.tintColor = UIColor(red:1, green:1, blue:1, alpha:0.6) self.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName: UIColor.white] if #available(iOS 11.0, *) { self.navigationBar

How do I add a Navigation Bar to a UITableViewController in Interface Builder?

时间秒杀一切 提交于 2019-11-29 20:36:46
Interface builder does not let me click and drag a Navigation Bar onto a Table View Controller!!! It is super frustrating. All I want is a table view with an edit button (done in interface-builder). If this is not possible, then how do I add a navbar progammatically? Thanks in advance. From the outline view, make sure your Table View Controller is selected. Then go to the Editor menu, and click on the Embed In submenu, and choose Navigation Controller and voila. You have your navigation controller pointing to your tableview controller with a relationship built in. stephenhow For a table view