uinavigationbar

iOS: navigation bar's titleView doesn't resize correctly when phone rotates

北城余情 提交于 2019-12-18 11:15:39
问题 I'm writing an iPhone app that (like most apps) supports auto-rotation: You rotate your phone, and its views rotate and resize appropriately. But I am assigning a custom view to navigationItem.titleView (the title area of the navigation bar), and I can't get that view to resize correctly when the phone rotates. I know what you're thinking, "Just set its autoresizingMask to UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight ," but it's not that simple. Of course, if I don't set

How can I get a full-sized UINavigationBar titleView

雨燕双飞 提交于 2019-12-18 11:07:08
问题 I am trying to add a custom control as the titleView in a UINavigationBar. When I do so, despite setting the frame and the properties that would normally assume full width, I get this: The bright blue can be ignored as it is where I am hiding my custom control. The issue is the narrow strips of navbar at the ends of the bar. How can I get rid of these so my customview will stretch 100%? CGRect frame = CGRectMake(self.view.bounds.origin.x, self.view.bounds.origin.y, self.view.width,

Change UINavigationBar font properties?

放肆的年华 提交于 2019-12-18 10:44:45
问题 I have an UINavigationBar added to my UIViewController view. I want to change the fonts properties. Note that I want to change a UINavigationBar not controller. In my app where I use UINavigationController I use self.navigationItem.titleView = label; to display the custom label. How can I accomplish to have a custom title in my UINavigationBar? P.S I use this to set the title text self.navBar.topItem.title = @"Information"; of my UINavigationBar. 回答1: From iOS 5 onwards we have to set title

UINavigationBar - Set title programmatically?

喜夏-厌秋 提交于 2019-12-18 10:44:14
问题 I have a tab bar application with a different view on each tab. Each view has a UINavigationBar with title set on Interface Builder. I want to change the title based on a clause in the ViewDidLoad method, so if x { change the title }. I have tried self.title = @"title" , but this changes the title of the tab bar item itself. So, how is this done? 回答1: I've set the title programmatically using code something like this: navBar.topItem.title = @"title"; where navBar is declared as an IBOutlet

iOS 8 NavigationBar BackgroundImage

二次信任 提交于 2019-12-18 10:18:04
问题 With iOS 8 the concept of just iPhone and iPad sizes along with portrait and landscape have changed and therefor setting the navigation bars background image isn't working the same. Currently i'm using the following code: UIImage *NavigationPortraitBackground = [[UIImage imageNamed:@"nav-image-portrait"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)]; UIImage *NavigationLandscapeBackground = [[UIImage imageNamed:@"nav-image-landscape"] resizableImageWithCapInsets:UIEdgeInsetsMake(0

UITableView goes under translucent Navigation Bar

自作多情 提交于 2019-12-18 10:09:13
问题 I am trying to have a transparent navigation bar in IOS 7 app. There is a full screen image in my application. I am also having a UITableView over that image. When I use the code below, image fits the screen as I want but UITableView goes under navigation bar. in viewDidLoad i use self.navigationController.navigationBar.shadowImage = [UIImage new]; self.navigationController.navigationBar.translucent = YES; self.navigationController.view.backgroundColor = [UIColor clearColor]; it is being ok

iOS: Removing UINavigationBar animation

烂漫一生 提交于 2019-12-18 09:49:55
问题 Our app has an UINavigationBar with an image on it. When we segue (push) to another screen then click the back button the image on the Navigation Bar seems to animate from left to right as it reappears. This is a little distracting. How can you remove this back button animation? We tried changing the segue Animates setting but this changes both the push animation and not the back animation. Our Nav Bar code: let logoImage:UIImage = UIImage(named: "ABC")! viewController.navigationItem

How can I set two buttons on the right side of an UINavigationBar?

我只是一个虾纸丫 提交于 2019-12-18 09:39:49
问题 I have made a standard Master-Detail application (with the Xcode template). I modified it, and now when I click one cell of the first table view the app shows another table view (which is the detail because is filtered by the clicked cell value). In a standard table view I would have this situation on the UINavigationBar: Edit Table title + (for adding new items) I need the default back button of UINavigationBar too. Is it possible and allowed to do this? Graphically it would be like this: <

Animating a navigation bar color

那年仲夏 提交于 2019-12-18 07:07:46
问题 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

Programmatically change height of navigation bar in swift

这一生的挚爱 提交于 2019-12-18 06:59:57
问题 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