uinavigationbar

Navigation bar with UIImage for title

不打扰是莪最后的温柔 提交于 2019-11-26 03:54:32
问题 I want to customize my app\'s look by using a logo image as the navigation bar\'s title, instead of plain text. When I use this code let logo = UIImage(named: \"logo.png\") self.navigationItem.titleView = logo; I get the error \"UIImage is not convertible to UIView\". How can I do this correctly? 回答1: Put it inside an UIImageView let logo = UIImage(named: "logo.png") let imageView = UIImageView(image:logo) self.navigationItem.titleView = imageView 回答2: I use this. It works in iOS 8 override

UINavigationBar custom back button without title

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-26 03:34:47
问题 How can I customize the navigation back button in iOS 7 and above without title? (i.e. with the arrow only) self.navigationItem.leftBarButtonItem = self.editButtonItem; I\'m just wondering if they have any self.backButtonItem; OR something like this? self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemBACK target:self action:@selector(back)]; 回答1: It's actually pretty easy, here is what I do: Objective C // Set this in every view

Trying to handle “back” navigation button action in iOS

混江龙づ霸主 提交于 2019-11-26 02:08:32
问题 I need to detect when the user taps the \"back\" button on the navigation bar, in order to perform some operations when that occurs. I\'m trying to set manually an action to such button, this way: [self.navigationItem.backBarButtonItem setAction:@selector(performBackNavigation:)]; - (void)performBackNavigation:(id)sender { // Do operations [self.navigationController popViewControllerAnimated:NO]; } I firstly placed that code in the view controller itself, but I found that self.navigationItem

How do I change the title of the “back” button on a Navigation Bar

ぐ巨炮叔叔 提交于 2019-11-26 01:48:33
问题 Currently the left bar button default value is the title of the view that loaded the current one, in other words the view to be shown when the button is pressed (back button). I want to change the text shown on the button to something else. I tried putting the following line of code in the view controller\'s viewDidLoad method but it doesn\'t seem to work. self.navigationItem.leftBarButtonItem.title = @\"Log Out\"; What should I do? Thanks. 回答1: This should be placed in the method that calls

iPhone Navigation Bar Title text color

本小妞迷上赌 提交于 2019-11-26 01:48:15
问题 It seems the iOS Navigation Bar title color is white by default. Is there a way to change it to a different color? I am aware of the navigationItem.titleView approach using an image. Since my design skills are limited and I failed to get the standard glossy, I prefer changing the text color. Any insight would be much appreciated. 回答1: Modern approach The modern way, for the entire navigation controller… do this once, when your navigation controller's root view is loaded. [self

Creating a left-arrow button (like UINavigationBar's “back” style) on a UIToolbar

柔情痞子 提交于 2019-11-26 01:38:28
问题 I\'d love to create a \"back\" left-arrow-bezel button in a UIToolbar . As far as I can tell, the only way to get one of these is to leave UINavigationController at default settings and it uses one for the left bar item. But there\'s no way I can find to create one as a UIBarButtonItem , so I can\'t make one in a standard UIToolbar , even though they\'re very similar to UINavigationBar s. I could manually create it with button images, but I can\'t find the source images anywhere. They have

How to hide UINavigationBar 1px bottom line

[亡魂溺海] 提交于 2019-11-26 01:25:20
问题 I have an app that sometimes needs its navigation bar to blend in with the content. Does anyone know how to get rid of or to change color of this annoying little bar? On the image below situation i have - i\'m talking about this 1px height line below \"Root View Controller\" 回答1: For iOS 13: Use the .shadowColor property If this property is nil or contains the clear color, the bar displays no shadow For iOS 12 and below: To do this, you should set a custom shadow image. But for the shadow

Tab bar controller inside a navigation controller, or sharing a navigation root view

风流意气都作罢 提交于 2019-11-25 23:51:19
问题 I\'m trying to implement a UI structured like in the Tweetie app, which behaves as so: the top-level view controller seems to be a navigation controller, whose root view is an \"Accounts\" table view. If you click on any account, it goes to the second level, which has a tab bar across the bottom. Each tab item shows a different list and lets you drill down further (the subsequent levels don\'t show the tab bar). So, this seems like the implementation hierarchy is: UINavigationController

Seeing black bars at the top and bottom of the iPhone X Simulator

白昼怎懂夜的黑 提交于 2019-11-25 23:34:51
问题 Running my App in the iPhone X Simulator (GM Seed) I am noticing two strange effects: the App does not use the full screen space (top and bottom area is black) a strange white bar beneath the title bar Does anybody know what is happening here and how to resolve this? I can\'t find any new settings in Interface Builder. 回答1: When using launch images (instead of the much easier Launch screen file), you need to provide the properly sized launch image for each device size you wish to support.

How do I change the title of the “back” button on a Navigation Bar

ε祈祈猫儿з 提交于 2019-11-25 23:33:29
Currently the left bar button default value is the title of the view that loaded the current one, in other words the view to be shown when the button is pressed (back button). I want to change the text shown on the button to something else. I tried putting the following line of code in the view controller's viewDidLoad method but it doesn't seem to work. self.navigationItem.leftBarButtonItem.title = @"Log Out"; What should I do? Thanks. Jordan This should be placed in the method that calls the ViewController titled "NewTitle". Right before the push or popViewController statement.