uinavigationbar

how to add items in uinavigationbar at a specific position?

只愿长相守 提交于 2019-11-29 16:38:12
I am developing one application for iphone and in that i have some issues regarding adding more then one UILabel in navigation bar at a specific position. What i want is in following images in above image there is one backbar button and one imageview as shown with arrow-mark. Other then that all white box is for difrent UILabels to show in navigation bar. There is only one UIImageView in the navigation bar and one left bar button. Now problem is that i don't know how to add multiple UILabel in navigation bar at a specific position. Till now what i have worked is to add only button and

How to Show and Hide UISearchDisplayController's UISearchBar

浪子不回头ぞ 提交于 2019-11-29 15:49:53
问题 I have a button search that located in the right side of the navigation. This is my code: UIButton *btnSearch = [UIButton buttonWithType:UIButtonTypeCustom]; btnSearch.frame = CGRectMake(0, 0, 22, 22); [btnSearch setImage:[UIImage imageNamed:@"search_btn.png"] forState:UIControlStateNormal]; [btnSearch addTarget:self action:@selector(showSearch:) forControlEvents:UIControlEventTouchUpInside]; UIBarButtonItem *searchItem = [[UIBarButtonItem alloc] initWithCustomView:_btnSearch]; self

Adding constraints to a UIBarButtonItem

爷,独闯天下 提交于 2019-11-29 14:29:06
Xcode is not allowing me to put constraints on my BarButtonItem on a ViewController in the MainStoryBoard. It's appearing too far to the left where it's unreadable as shown in the image. The image below shows where the BarButtonItem is. It's supposed to say "Item". I also looked on the preview split screen on Xcode and it looked fine for the iPhone6 but not for the iPhone 4 (it's half cut on the iPhone 4 but here its 3/4s cut). Here I'm running for the iPhone 6 and i get that. How do I add constraints in Xcode or how do I add the constraints programmatically to this BarButtonItem? Any help is

Back button is not visible in iOS 7

旧街凉风 提交于 2019-11-29 14:23:22
问题 I have some weird trouble about iOS 7. I have an UINavigationBar in my app and it works perfect for iOS 6; -- IOS 6 -- However, when i try to run it on iOS 7, my back button disappeared. It's there, still working and clickable but not visible; -- IOS 7 -- How can I fix this problem ? 回答1: Setting BackButtonBackgroundImage via UIAppearance currently has some odd behavior in iOS 7. This is probably related to the updated design, which replaces the rect-style button with a backIndicatorImage (an

How do I left align the title of a navigation bar in Xcode?

北城余情 提交于 2019-11-29 13:36:17
I've been trying the following in order to get the title of a navigation bar left aligned: In the AppDelegate.swift file: func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { // Override point for customization after application launch. UINavigationBar.appearance().barTintColor = UIColor.red UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName: UIColor.white] return true } In a TableViewController.swift file: override func viewDidAppear(_ animated: Bool) { super.viewDidAppear

UINavigationBar custom transition animation

天涯浪子 提交于 2019-11-29 13:00:31
问题 I've created custom transitions between view controllers using the following protocols: UIViewControllerAnimatedTransitioning and UIViewControllerTransitioningDelegate Is it possible using the default UINavigationBar , to create custom transitions for the titles, right now they simply crossfade between view controllers, Or do i have to built my own navigation bar view from scratch? 回答1: WWDC 2013 video #218 indicates that all custom transitions will crossfade the navigation bar, and that

Animating a navigation bar color

两盒软妹~` 提交于 2019-11-29 12:20:32
I am trying to animate a change of color of a navigation bar when popping back to a previous controller. To give it some context, I have controller A which is a collectionView Controller and has an opaque navigation bar color set by: self.navigationController?.navigationBar.barTintColor = UIColor.rgb(red: 244, green: 67, blue: 54) self.navigationController?.navigationBar.tintColor = .white self.navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white] self.navigationController?.navigationBar.isTranslucent = false Once a collectionViewCell is

Programmatically change height of navigation bar in swift

风流意气都作罢 提交于 2019-11-29 12:01:51
I want to make a taller navigation bar and I am trying to do this using a subclass of UINavigationBar. Here is my subclass of UINavigationBar: import UIKit class TallerNaviBar: UINavigationBar { override func sizeThatFits(size: CGSize) -> CGSize { var newSize:CGSize = CGSizeMake(size.width, 87) return newSize } } And in my ViewController which is embedded in a navigation controller, I write the following code in the viewDidLoad() function self.navigationController!.setValue(TallerNaviBar(frame: CGRectMake(0, 0, self.view.frame.size.width, 87)), forKeyPath: "navigationBar") There is no error

iOS 10 custom navigation bar height

天大地大妈咪最大 提交于 2019-11-29 10:11:33
I implemented custom navigation bar height, by subclassing it with following code class TMNavigationBar: UINavigationBar { ///The height you want your navigation bar to be of static let navigationBarHeight: CGFloat = 44.0 ///The difference between new height and default height static let heightIncrease:CGFloat = navigationBarHeight - 44 override init(frame: CGRect) { super.init(frame: frame) initialize() } required init?(coder aDecoder: NSCoder) { super.init(coder: aDecoder) initialize() } private func initialize() { let shift = TMNavigationBar.heightIncrease/2 ///Transform all view to shift

UIButton in Navigation Bar Not Recognizing Taps in iOS 11

∥☆過路亽.° 提交于 2019-11-29 07:05:52
I have a UIButton in a navigation bar that sits over the top of a UIImage and a UILabel . It worked fine in iOS 10, but now in iOS 11 it doesn't recognize any taps from my @IBAction outlet. I tried moving the tap outlet to the bar button item, but that didn't work either. The UIButton has the following constraints: I confirmed that it's there by giving it a green background, so I know it's visible and available. Any idea what's going on? I found a solution from another developer. You have to add width and height constraints to the view that wraps all your stuff inside the bar button item. So