uinavigationbar

UINavigationBar multi-line title

江枫思渺然 提交于 2019-11-27 00:08:56
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? petert Set the titleView property of the UINavigationItem . For example, in the view controller's viewDidLoad method you could do something like: UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 480, 44)]; label.backgroundColor =

Get search bar in navigation bar in Swift

。_饼干妹妹 提交于 2019-11-27 00:03:07
问题 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....

UISearchBar increases navigation bar height in iOS 11

丶灬走出姿态 提交于 2019-11-26 23:57:47
I have my UISearchBar being part of the navigation bar like: let searchBar = UISearchBar() //some more configuration to the search bar ..... navigationItem.titleView = searchBar After updating to iOS 11 something weird happened to the search bar in my app. On iOS 10 and prior I had my navigation bar looking like: Now with iOS 11 I have: As you can see there is difference in the rounding of the two search bars which does not bothers me. The problem is that the search bar increases the height of the navigation bar. So when I go to another controller it looks weird too: In fact that weird black

How to add Badges on UIBarbutton item?

非 Y 不嫁゛ 提交于 2019-11-26 23:56:42
Hi friends am new to iphone developing. Am struggle with add badge values on UIBarbutton item on right side. I have tried but i can't solve this problem. Can anyone help me. Thanks in advance! I know this post is pretty old but with iOS7, MKNumberBadgeView's appearance does not really match the tab bar item badge design. I have found this other component which herits UIBarButtonItem and do the job very well : https://github.com/TanguyAladenise/BBBadgeBarButtonItem Hope this may help other iOS7 developers like me Yuvaraj.M Finally i found the way to add badges on UIBarbutton item. I searched

Programmatically get height of navigation bar

最后都变了- 提交于 2019-11-26 23:55:27
问题 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

How to animate add UISearchBar on top of UINavigationBar

笑着哭i 提交于 2019-11-26 23:50:33
问题 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 回答1: 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 =

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

混江龙づ霸主 提交于 2019-11-26 23:42:24
问题 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

iOS 11 navigation bar height customizing

半腔热情 提交于 2019-11-26 23:35:56
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? frangulyan 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 in storyboard: look like this on the device: Now you can do a workaround that was suggested in

Set a custom subclass of UINavigationBar in UINavigationController programmatically

巧了我就是萌 提交于 2019-11-26 23:28:13
Does anyone know how can I use my custom subclass of UINavigationBar if I instantiate UINavigationController programmatically (without IB)? Drag a UINavigationController in IB show me an under Navigation Bar and using Identity Inspectory I can change class type and set my own subclass of UINavigationBar but programmatically I can't, navigationBar property of Navigation Controller is readonly... What should I do to customize the navigation bar programmatically? Is IB more "powerful" than "code"? I believed all that can be done in IB could be done also programmatically. You don't need to muck

How to prevent UINavigationBar from covering top of view in iOS 7?

早过忘川 提交于 2019-11-26 23:21:53
After updating to Xcode 5, the navigation bars in all of my app's views have shifted down. Here are some screenshots, the first showing everything in the view as it's pulled down, and the second showing all of it untouched. The search bar should begin where the navigation bar. Anyone know how I can fix this? edit: i have tried this previously recommendation: if ([self respondsToSelector:@selector(edgesForExtendedLayout)]) self.edgesForExtendedLayout = UIRectEdgeNone; But it yields very odd results. This may be because I have a "slide menu" under this view controller that is appearing due to