uinavigationbar

How to set font & color of the title in UINavigationBar using iOS5 appearance API?

只谈情不闲聊 提交于 2019-11-26 22:33:24
问题 I have a multiple View Controllers and I want to set the font color of all to red. [[UINavigationBar appearance] setFont:[UIFont boldSystemFontOfSize:12.0]]; is throwing an unrecognized selector error. How can I fix this? 回答1: From Ray Wenderlich: http://www.raywenderlich.com/4344/user-interface-customization-in-ios-5 // Customize the title text for *all* UINavigationBars [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys: [UIColor colorWithRed

Change the navigation bar's font

对着背影说爱祢 提交于 2019-11-26 22:20:02
问题 The question is plain easy and simple, the answer unfortunately not. How can you change the font of the text in the UINavigationBar ? 回答1: From iOS 7 and later: NSShadow* shadow = [NSShadow new]; shadow.shadowOffset = CGSizeMake(0.0f, 1.0f); shadow.shadowColor = [UIColor redColor]; [[UINavigationBar appearance] setTitleTextAttributes: @{ NSForegroundColorAttributeName: [UIColor greenColor], NSFontAttributeName: [UIFont fontWithName:@"Helvetica" size:20.0f], NSShadowAttributeName: shadow }];

Change UINavigationBar Height

假如想象 提交于 2019-11-26 22:14:37
Can some one tell me how to change the navigation bar height? Here is what i have so far: CGFloat navBarHeight = 10; self.navigationController.navigationBar.frame.size.width = navBarHeight; Shimon Wiener You can create a category class based on UINavigationBar like this .h file #import UIKit/UIKit.h @interface UINavigationBar (myNave) - (CGSize)changeHeight:(CGSize)size; @end and .m file #import "UINavigationBar+customNav.h" @implementation UINavigationBar (customNav) - (CGSize)sizeThatFits:(CGSize)size { CGSize newSize = CGSizeMake(320,100); return newSize; } @end It works very nice. You

UINavigationBar's drawRect is not called in iOS 5.0

孤者浪人 提交于 2019-11-26 22:09:07
I've overrided(placed in category, or swizzled) UINavigationBar's drawRect to show custom background. In iOS 5 it's not working. What should I do? Manni Setting custom background for UINavigationBar to support iOS5 and iOS4 too! http://www.mladjanantic.com/setting-custom-background-for-uinavigationbar-what-will-work-on-ios5-and-ios4-too/ http://rogchap.com/2011/06/21/custom-navigation-bar-background-and-custom-buttons/ As you know, until iOS 5 came out, we used drawRect override in AppDelegate to customize UINavigationBar . But know, iOS 5 give us some new method for styling (and old doesn’t

iPhone - How set uinavigationbar height?

孤街浪徒 提交于 2019-11-26 21:54:32
I want to make the top of the navigation view a bit smaller. How would you achieve this? This is what I've tried so far, but as you can see, even though I make the navigationbar smaller, the area which it used to occupy is still there (black). [window addSubview:[navigationController view]]; navigationController.view.frame = CGRectMake(0, 100, 320, 280); navigationController.navigationBar.frame = CGRectMake(0, 0, 320, 20); navigationController.view.backgroundColor = [UIColor blackColor]; [window makeKeyAndVisible]; rnaud Create a UINavigationBar Category with a custom sizeThatFits.

Real time blur effect for Navigation Bar

主宰稳场 提交于 2019-11-26 21:54:31
How to achieve the real time blurring effect for the navigation bar just like the Trailers app in iPhone. i.e As you scroll the contents should get blurred behind the navigation bar. Please help me with some code. Thanks! I want to achieve an effect like this:- Kampai Apple has introduced new classes UIVisualEffectView and more to add translucency and blur effect on views from iOS 8.0 release. Here how you can use it to add blur effect to navigation bar or any other UIView : Swift 2.1 Edit func addBlurEffect() { let bounds = self.navigationController?.navigationBar.bounds as CGRect! let

Multiline Navigationbar Title

我与影子孤独终老i 提交于 2019-11-26 21:37:26
问题 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

iOS 7 Status Bar Collides With NavigationBar

自古美人都是妖i 提交于 2019-11-26 21:33:01
I have a view controller in my app that has a navigation bar dragged on it in the storyboard. It was working fine in the iOS 6 but in iOS 7 it look like this: The status bar and the navigation bar should no collide with each other. I have seen a lot of such questions on the stack overflow but they didn't of much help to me. Some questions say that i should use this "self.edgesForExtendedLayout = UIRectEdgeNone;" but it didn't work. Some say i should remove the navigation bar and embed it inside the navigation controller that i cannot do due to the way my program is implemented. Some solutions

Hide Status Bar and Increase the height of UINavigationBar

隐身守侯 提交于 2019-11-26 21:19:39
问题 I am using story board to create navigation bar. My requirement is to hide the status bar and increase the height of Navigation bar. When i hide the status bar, the navigation bar sticks to top and the height is 44 px. i need a navigation bar height as 64 px (44px+status bar height). Is there any way to do this? With status bar Without status bar 回答1: To start off, you hide your statusBar by following these steps: First, put this code in viewWillAppear : [[UIApplication sharedApplication]

Custom nav bar styling - iOS [duplicate]

眉间皱痕 提交于 2019-11-26 21:09:17
Possible Duplicate: How to add background image on iphone Navigation bar ? iOS - How did the NY Times do this custom top navigation bar styling? And for that matter, the bottom one? ludwigschubert EDIT: This is outdated; for iOS5 there's a much better answer below , by @Jenox. Completely custom styling for Navigation Bars is surprisingly difficult. The best writeup I know of is this one by Sebastian Celis: http://sebastiancelis.com/2009/12/21/adding-background-image-uinavigationbar/ This doesn't override drawRect, and includes a good explanation why that's a good thing. Also note you don't