uinavigationbar

Add subtitle under the title in navigation bar controller in Xcode

爷,独闯天下 提交于 2019-11-28 03:28:35
So I'm wanting to add a "subtitle" under the title in the navigation bar in navigation controller. Mostly everything I look up so far wants me to use CGRect. I don't know a whole lot what that is and it sounds like its wanting me to create an entire new view which is not what I am wanting to do. My question is, is there a dot method to adding a subtitle view easily? The closest thing I found was posted on stack overflow and here is the link: Create a subtitle in navigationbar Apparently last year this worked but now I am getting errors and it's in my viewDidLoad... I tried this: self

Get search bar in navigation bar in Swift

孤街醉人 提交于 2019-11-28 03:27:27
So I've tried everything trying to get a search bar into the navigation bar in Swift. But sadly I haven't gotten it working, just yet... For those of you who don't know what I'm talking about, I'm trying to do something like this Note the search bar in the navigation bar. So here's what I'm currently using self.searchDisplayController?.displaysSearchBarInNavigationBar = true I popped that in my viewDidLoad , and then when I load up the app I'm presented with, just an empty navigation bar.... :( Any ideas? Leo Try this let leftNavBarButton = UIBarButtonItem(customView:Yoursearchbar) self

How to hide the navigation bar and toolbar as scroll down? Swift (like myBridge app)

試著忘記壹切 提交于 2019-11-28 03:21:04
I want to hide a toolbar and nav bar as I scroll down a page. And return it as I scroll up. How is this possible? How would I go about detecting the drag? Do I use pan gesture or is this down with the scrollview? Try this simple approach: Tested in Swift 3 func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) { if(velocity.y>0) { //Code will work without the animation block.I am using animation block incase if you want to set any delay to it. UIView.animate(withDuration: 2.5, delay: 0, options:

Programmatically get height of navigation bar

最后都变了- 提交于 2019-11-28 03:05:10
I know that the presence of the more view controller (navigation bar) pushes down the UIView by its height. I also know that this height = 44px. I have also discovered that this push down maintains the [self.view].frame.origin.y = 0 . So how do I determine the height of this navigation bar, other than just setting it to a constant? Or, shorter version, how do I determine that my UIView is showing with the navigation bar on top? The light bulb started to come on. Unfortunately, I have not discovered a uniform way to correct the problem, as described below. I believe that my whole problem

Change color of Back button in navigation bar

孤人 提交于 2019-11-28 02:58:11
I am trying to change the color of the Settings button to white, but can't get it to change. I've tried both of these: navigationItem.leftBarButtonItem?.tintColor = UIColor.whiteColor() navigationItem.backBarButtonItem?.tintColor = UIColor.whiteColor() but no change, it still looks like this: How do I make that button white? Etgar You can change the global tint color in your storyboard by clicking on an empty space on the board and select in the right toolbar "Show the file inspector", and you will see in the bottom of the toolbar the "Global Tint" option. Chamath Jeevan This code changes the

How to animate add UISearchBar on top of UINavigationBar

旧城冷巷雨未停 提交于 2019-11-28 02:50:11
If I set the displaysSearchBarInNavigationBar = YES in viewDidLoad , the search bar will be in navigation bar when the view show up. But I want to show search bar on top of navigation bar when I touch bar button item. It's like image below normal navigation bar: search bar on top of navigation bar after right bar button item clicked I've modified Mark's answer a little to get it to work in IOS 8 and in swift. class ViewController : UIViewController, UISearchBarDelegate { var searchBar = UISearchBar() var searchBarButtonItem: UIBarButtonItem? var logoImageView : UIImageView! override func

iOS 7 Custom UINavigationBar TitleView moves when Pushing or Popping new View Controller

余生长醉 提交于 2019-11-28 02:27:46
问题 I am using a custom title view for a UINavigationBar with the following code: // Set a label to the nav bar THLabel *titleLabel = [[THLabel alloc] init]; titleLabel.text = @"Test"; titleLabel.font = [UIFont fontWithName:APP_FONT size:22.0]; titleLabel.frame = CGRectMake(0, 0, 100, 30); titleLabel.textAlignment = NSTextAlignmentCenter; titleLabel.textColor = CUSTOM_LIGHT_BLUE; titleLabel.strokeColor = kStrokeColor; titleLabel.strokeSize = kStrokeSize; self.navigationItem.titleView = titleLabel

ios7 - iPhone 5 giving white space at the top

爱⌒轻易说出口 提交于 2019-11-28 02:25:29
问题 Client has come back to me on projects saying they see white space on the top (they can't see the default things like time, wifi signal, etc) at the top. This is happening when they installed iOS7 on their iPad. Any idea why this is happening? Note: I have navigation bar as image. I hide the navigation bar and put navigation bar as an image. Downvoters I know this is not a perfect question for SO, but I thought to ask to take inputs. Tomorrow I am going to study on it. 回答1: try to insert

How to Change back button title on navigation controller in swift3?

旧时模样 提交于 2019-11-28 02:13:30
I want to change the title of backbutton to any name in swift 3.I tried many ways but none of them worked for me. self.navigationItem.backBarButtonItem?.title="Title" self.navigationController?.navigationItem.backBarButtonItem?.title="Title" Just for information i have written below code in appdelegate. let backImage : UIImage = UIImage(named:"backArrow")! UINavigationBar.appearance().barTintColor = UIColor(red: 0.0/255.0, green: 0.0/255.0, blue: 0.0/255.0, alpha: 1.0) UINavigationBar.appearance().tintColor = UIColor.white UINavigationBar.appearance().backIndicatorImage = backImage

Multiline Navigationbar Title

ぐ巨炮叔叔 提交于 2019-11-27 23:57:38
I am trying to set the title label in my navigation bar to allow multiple lines. I have custom navigation controller code that I am placing the multiline code into. I know that the code already there works, but my multiline part is not working. let titleLabel = UILabel() titleLabel.frame = CGRectMake(0, 0, self.navigationBar.frame.width, self.navigationBar.frame.height * 2) titleLabel.numberOfLines = 0 titleLabel.lineBreakMode = .ByWordWrapping navigationItem.titleView = titleLabel But the text still runs off at the end. I've also tried putting this into the individual view controller itself,