uinavigationbar

Creating a UIBarButton Centered Programmatically

橙三吉。 提交于 2019-11-28 11:52:28
问题 I have an array of bar buttons that I normally set with something like: NSArray *leftButtonArray = [[NSArray alloc]initWithObjects: backBarButton, separator1,postBarButton, separator1, memeBarButton, separator1, pollBarButton, nil]; self.navigationItem.leftBarButtonItems = leftButtonArray; However, I want to change these buttons on the left to instead be center aligned. Anyone know how I can do that? Providing an example or using my buttons to do so would be a plus. Thanks! 回答1: As I

How can I get the color and translucency of the iOS 10 watch Navigation Bar?

China☆狼群 提交于 2019-11-28 11:39:32
问题 I am looking to get the translucency and color of the iOS 10 watch navigation bar. I managed the color by color picking the RGB but I cannot figure out the translucency. I am using Swift 3, can anyone tell me how to get the translucency? I have circled what translucency I'm looking for. Please provide the code if you can. 回答1: Use below method to achieve navigationBar translucent effect . When UIContentView scrolls as the picture you posted. In viewDidLoad: view.backgroundColor = UIColor

Back Button Image - what is it called in Swift?

懵懂的女人 提交于 2019-11-28 11:36:49
I am trying to use Swift's internal back button image. I have asked this question before and got the technically correct answer that it inherits it from the previous View, BUT if I insert this code you can control the back button on the current View. // Takeover Back Button self.navigationItem.hidesBackButton = false let newBackButton = UIBarButtonItem(title: "<", style: .Plain, target: self, action: "segueBack") navigationItem.leftBarButtonItem = newBackButton That gives me a <, "ABC" would give me ABC etc but how do I trigger Swift to put up it's internal Back Button image. The code below

UINavigationItem titleView “ignored if leftBarButtonItem is set”?

早过忘川 提交于 2019-11-28 11:02:53
The documentation for UINavigationItem's titleView property says : "This property is ignored if leftBarButtonItem is not nil." However, I've set both the titleView and leftBarButtonItem properties in my testing and they both appear to show up fine. I've tested on all the simulators in my Xcode: 4.3, 5.0, and 5.1. Does anyone know if the documentation is just wrong, or is it correct on some older versions (e.g. 4.2, 3.x) that I haven't been able to test? indisoluble Check the documentation for property leftBarButtonItems , it says: If there is not enough room to display all of the items in the

How to add navigation interface after create a tab bar controller programmatically (Swift)

时光毁灭记忆、已成空白 提交于 2019-11-28 10:35:45
How do I add a navigation interface programmatically on Swift after I created a TabBarController on AppDelegate/didFinishLaunchingWithOptions . Here are my current codes: self.window = UIWindow(frame: UIScreen.mainScreen().bounds) let tabBarController = UITabBarController() let purchaseViewController = PurchaseViewController(nibName: "PurchaseViewController", bundle: nil) let financeViewController = FinanceViewController(nibName: "FinanceViewController", bundle: nil) tabBarController.viewControllers = [purchaseViewController, financeViewController] self.window!.rootViewController =

how to add items in uinavigationbar at a specific position?

烂漫一生 提交于 2019-11-28 09:52:36
问题 I am developing one application for iphone and in that i have some issues regarding adding more then one UILabel in navigation bar at a specific position. What i want is in following images in above image there is one backbar button and one imageview as shown with arrow-mark. Other then that all white box is for difrent UILabels to show in navigation bar. There is only one UIImageView in the navigation bar and one left bar button. Now problem is that i don't know how to add multiple UILabel

UISearchController doesn't work properly with a non-translucent UINavigationBar

我怕爱的太早我们不能终老 提交于 2019-11-28 09:41:23
Currently I am trying to embed a UISearchController into my application. But the UISearchBar, which is a property of the UISearchController, doesn't get displayed properly, if the UINavigationBar is non-translucent. Usually after tapping the UISearchBar property, the UINavigationBar moves up to make room for the UISearchBar. You can see the result on the following screenshot: https://www.dropbox.com/s/172k63zr2bhj84t/Normal_behaviour.png?dl=0 But if the "translucent" property of the UINavigationBar is set to "NO", the UISearchBar doesn't get displayed properly, because the background of the

Draw custom Back button on iPhone Navigation Bar

你离开我真会死。 提交于 2019-11-28 09:17:48
I've got a UIView with a NavigationBar and I'd like to add a button which looks like the style of a Back Button. I'm not using a UINavigationController and was wondering if this could be done without it? The style of the button should look like this: Thanks Mike Weller You need to set up a custom stack of UINavigationItem objects and push them on to the UINavigationBar. This is the only way I know of to get a true back button. I haven't tested this code, but you should do something like this: UINavigationItem *previousItem = [[[UINavigationItem alloc] initWithTitle:@"Back title"] autorelease];

UINavigationBar overlaps UITableView when programmatically setting prompt

会有一股神秘感。 提交于 2019-11-28 09:04:17
问题 I have a UINavigationController which contains a UITableViewController . This navigation controller pushes other UITableViewControllers around and eventually these table view controllers will have a prompt. The problem is when I set this prompt programmatically it overlaps the content of the table view underneath it. (A search bar is being hidden by the navigation bar) I was looking around in SO and found this answer. I tried the suggestion there in two different ways in the affected view

How do I change the background of a UINavigationBar?

主宰稳场 提交于 2019-11-28 08:47:59
I'd like to change the background of my UINavigationBar to a [UIColor colorWithImage:] , but it isn't working. What am I missing? EDIT: Once I've created my subclass, where do I set the UINavigationController to use it? You can use the tintColor property to change the colour of a UINavigationBar , but to set an image as the background you'll have to provide your own UINavigationBar subclass and override the drawRect: method, for example: - (void)drawRect:(CGRect)rect { // Drawing code UIImage *img = [UIImage imageNamed: @"background-image.png"]; [img drawInRect:CGRectMake(0, 0, self.frame.size