uinavigationbar

Custom back indicator image in iOS 7 not vertically centered

吃可爱长大的小学妹 提交于 2019-12-10 12:30:41
问题 I am using the following code to use a custom image for the back indicator in my iOS 7 app: UIImage *temp = [[UIImage imageNamed:@"back-black-on-black-normal-2"] imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]; [[UINavigationBar appearance] setBackIndicatorImage:temp]; [[UINavigationBar appearance] setBackIndicatorTransitionMaskImage:temp]; The strange thing is, if I use an image that is 22px high (way too small for what we want, by the way), it centers vertically within in the nav

UISearchBar with hidden UINavigationBar

…衆ロ難τιáo~ 提交于 2019-12-10 12:24:37
问题 I have the search bar in the top of the table and the hidden navigation bar. Along with UISearchBar I use UISearchDisplayController . UISearchDisplayController has the possibility to bring forward the navigation bar. So, when I tap the cancel button in the search bar, the navigation bar fly's down. How can I dismiss this possibility, so the navigation bar will always be hidden? Thanks 回答1: One solution is to make the search bar the table header view in which case it will scroll with the table

iOS 13: NavigationBar BarStyle is ignored when using UINavigationBarAppearance

江枫思渺然 提交于 2019-12-10 11:08:16
问题 I have a custom colour Navigation Bar and I need to make sure the Status Bar colour is set to white. In pre iOS 13 this was easy to do, here is a code snippet from a UIViewController that did the job just fine: override func viewDidLoad() { super.viewDidLoad() self.navigationController?.navigationBar.barStyle = .black } The issue I'm facing with iOS 13 is that I now need to use the NavigationBar's standardAppearance and scrollEdgeAppearance to undo the forced background transparency in the

Storyboard loses navigation bar when segueing via tap gesture

亡梦爱人 提交于 2019-12-10 10:57:15
问题 My app has two scenes: a UIViewController with a navigation bar at the top, and a UITableViewController. If I wire up a button in the first scene to segue to the table view, everything looks great. However, if I wire up a tap gesture in the first scene to segue to the table view, then the navigation bar doesn't display in the second scene in Xcode. When the app is run, the navigation bar appears as it should, but in the storyboard editor it is gone. Is there something special that needs to be

Custom View in tab bar does no longer work in iOS6

随声附和 提交于 2019-12-10 10:57:04
问题 I have a custom View ( UILabel + UIImage ) which I use as the custom view of my UINavigationController which I set like so: self.navigationItem.titleView = self.myTitleLabel; This works fine in iOS 5 but ceases to work under iOS 6. Although the value is set in the debugger, it does not show at all. Update: As mark pointed out the docs states the following: If this property value is nil , the navigation item’s title is displayed in the center of the navigation bar when the receiver is the top

how do I change the UINavigationBar's height

萝らか妹 提交于 2019-12-10 10:56:49
问题 This issue has crippled me for over a day. I need to modify the UINavigationBar's height. The UINavigationController is created in the AppDelegate like so. self.navigationController = [[UINavigationController alloc] initWithRootViewController:mainController]; [self.window addSubview:self.navigationController.view]; [self.window makeKeyAndVisible]; The height of the navbar WILL change and stick if I add [self.navigationController.navigationBar setFrame:newFrame] to viewDidAppear like the code

Customizing appearance of UISearchBar & UINavigationBar in AppDelegate? Why customize at class and not instance level?

不问归期 提交于 2019-12-10 10:37:15
问题 I am following this tutorial. In its AppDelegate it has a customizeAppearance() where UISearchBar & UINavigationBar are type/class properties. Shouldn't they be a property of something like the window or the current viewController we are in?! How can we just message a class and then have it change our UI? FWIW when I cmmd click...obviously it just takes it to the class definition. import UIKit @UIApplicationMain class AppDelegate: UIResponder, UIApplicationDelegate { var

Affecting a UINavigationBar's Back Button Method (iOS)

二次信任 提交于 2019-12-10 10:26:34
问题 I have a table view that pushes to a detail view controller. From the detail view controller, when I press the 'back' button, I'd like an integer value to change. How do I edit the navigation bar back button's action programatically. The back button is automatically placed in my app because I'm using a table view so I didn't actually create the button, so I don't know how to affect it's method. To be clear, I still want the back button to go back to the original view, but simultaneously

How to add a standard info button to a navigation bar in iOS?

对着背影说爱祢 提交于 2019-12-10 09:58:01
问题 I'd like to add a right bar button with the system's info icon to a navigation bar. But I see that UIBarButtonSystemItem does not provide such type of button. On the other hand, so I tried with a UIButton of type UIButtonType.infoLight , but I am not allowed to assign it to navigationItem.rightBarButtonItems . Is there any way to do this? 回答1: this can be achieved using UIButton object of type .infoLight let infoButton = UIButton(type: .infoLight) infoButton.addTarget(self, action: #selector

iOS 11 scroll to top when using large titles doesn't work properly

独自空忆成欢 提交于 2019-12-10 06:59:28
问题 When using large titles and tapping the status bar to scroll to the top of a UIScrollView or UITableView (probably also UICollectionView , haven't tested this) it always goes a little too far. I have refresh enabled on my TableView and when tapping the status bar it appears like this and stays that way until I tap the screen. I have a ScrollView in another ViewController and if I tap the status bar there it also scrolls a little bit too far, making the navigation bar too tall. This also