uinavigationbar

iOS 10 custom navigation bar height

女生的网名这么多〃 提交于 2019-12-18 05:51:22
问题 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() }

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

↘锁芯ラ 提交于 2019-12-18 05:50:53
问题 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

UITextField within UISearchBar in iOS 7

喜你入骨 提交于 2019-12-18 03:22:13
问题 I am trying to accomplish the same look of my UISearchBar with a TextField within it, as in my iOS 6 app. I have tried to code it in several ways and not yet been successful. The problem is, I am not able to change the TextField's frame in any way since iOS 7. The result is, my TextField takes all the space in the NavigationBar and overrides the UIBarButtonItem (menu button) to the right. See pictures below: iOS 6 code: This is how I coded it in iOS 6, where I could set the TextFields frame

iOS 7 : Disable UINavigationBar Translucency For Entire App

落花浮王杯 提交于 2019-12-17 23:47:33
问题 Is there a way to disable UINavigationBar Translucency for an entire application? I'm aware that using [self.navigationController.navigationBar setTranslucent:NO] can fix this issue for a single controller, but I have a lot of UINavigationBars in my application and this is a pretty tedious solution. I've tried [[UINavigationBar appearance] setTranslucent:NO] , but that functionality is surprisingly not supported. Doing that results in Terminating app due to uncaught exception

Set navigation bar image in iOS 7

半城伤御伤魂 提交于 2019-12-17 23:38:49
问题 I want to convert my current project from iOS 6 to iOS 7. In iOS 6 my project is working fine, but in iOS 7 navigation bar image is not showing properly. I used this code snippet for iOS 6, UIImage *imgNav = [UIImage imageNamed:@"navigation.png"]; self.navigationController.navigationBar.frame = CGRectMake(0, 0, 320, 44); [self.navigationController.navigationBar setBackgroundImage:imgNav forBarMetrics: UIBarMetricsDefault]; How can I set the navigation bar image in iOS 7? 回答1: Try Adding the

How to change navigationBar height in iOS 11?

冷暖自知 提交于 2019-12-17 23:03:03
问题 Apparently changing the navigationBar height faced a new approach in iOS 11. in previous iOS versions it was possible to change the navigationBar height by hiding the default navigationBar and adding a new one with custom frame: self.navigationController?.setNavigationBarHidden(true, animated: false) let customNavigationBar = UINavigationBar(frame: CGRect(x: 0, y: 0, width: self.view.bounds.width, height: 64)) self.view.addSubview(customNavigationBar) But it seems that it is not working in

How to hide the navigation bar in a WPF page

强颜欢笑 提交于 2019-12-17 22:35:03
问题 I want to hide the navigation bar in a page created using WPF. I have tried ShowsNavigationUI = false , but it is still displaying the control. 回答1: Setting ShowsNavigationUI=false on a Page object ought to do it. There does seem to be a bug, however, that will cause this to fail in at least one sequence of events: Page is already in NavigationWindow when this is set Page is navigated away and back again There may be other scenarios I haven't run into yet that make it fail. To get this to

Swift-How do I add Tab Bar AND Navigation Bar to a single view controller?

浪尽此生 提交于 2019-12-17 22:15:06
问题 Using XCode, and either through Code or through the Storyboard, can someone please explain to me how to add both a Tab Bar and Nav Bar to my view controller while keeping both visible? Thanks so much. 回答1: In your Storyboard, you should drag out a Tab Bar Controller and use that as the initial view controller. Then, you should embed each of the view controllers attached to the Tab Bar Controller inside Navigation Controllers (Editor menu: Embed In > Navigation Controller). Afterward, your

How do I disable the navigation bar shadow in iOS 6 for navigation bars with custom background images?

无人久伴 提交于 2019-12-17 22:05:12
问题 It seems in iOS 6, a drop shadow is automatically added to the navigation bar even when you set a custom background image. I'm pretty sure this wasn't the case with iOS 5 as when I test the same code in the iOS 5 and 6 sim, the shadow appears in iOS 6 but not 5. Does anyone know anything about this? Or how to enable/disable it? 回答1: Place this in your AppDelegate [[UINavigationBar appearance] setShadowImage:[UIImage new]]; // is IOS 7 and later [[UINavigationBar appearance] setBackgroundImage

Navigation bar has wrong position when modal a view controller with flip horizontal transition in iOS 7

一世执手 提交于 2019-12-17 21:47:55
问题 When I am trying to modal a view controller with flip horizontal transition in iOS7, the origin of navigation bar is (0, 0) at beginning and then jump to the right position at (0, 20). Is it possible to make it behave the same with in iOS6? You can download the project here. I have created a customized navigation bar as following: @implementation MyCustomNavigationBar - (void)drawRect:(CGRect)rect { [super drawRect:rect]; UIImage *image = [UIImage imageNamed:@"Custom-Nav-Bar-BG.png"]; [image