uinavigationbar

center custom title in UINavigationBar?

爱⌒轻易说出口 提交于 2019-11-28 18:23:58
I have a custom UINavigationBar title and a custom back button. My problem is that the title is not centered on the iPhone. It is as if my back button is pushing the title over to the right. Any Idea how I can center it? int height = self.navigationController.navigationBar.frame.size.height; int width = self.navigationController.navigationBar.frame.size.width; UILabel *navLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, width + 300, 20)]; navLabel.backgroundColor = [UIColor whiteColor]; navLabel.textColor = [UIColor redColor]; navLabel.font = [UIFont fontWithName:@"Helvetica" size:30];

NSFontAttributeName has changed to String

余生长醉 提交于 2019-11-28 18:12:26
i'm trying to style the navigation bar properly, i need to change the font to helvetica neue with a size point of 19. I've ever used this code but i've notice that now doesn't work as well: navigationController?.navigationBar.titleTextAttributes = [NSFontAttributeName: UIFont(name: "HelveticaNeue-Light", size: 19)] this happens because the type of NSFontAttributeName has changed to String, i've tried to fix it with navigationController?.navigationBar.titleTextAttributes = [NSFontAttributeName: "HelveticaNeue-Light, 19"] but the compiler continue to give me an error related to point size in

How to hide the navigation bar in a WPF page

有些话、适合烂在心里 提交于 2019-11-28 18:12:09
I want to hide the navigation bar in a page created using WPF. I have tried ShowsNavigationUI = false , but it is still displaying the control. Setting ShowsNavigationUI=false on a Page object ought to do it. There does seem to be a bug, however, that will cause this to fail in at least one sequence of events: Page is already in NavigationWindow when this is set Page is navigated away and back again There may be other scenarios I haven't run into yet that make it fail. To get this to work totally reliably, what I do is ignore the Page.ShowsNavigationUI property entirely and set it instead on

UINavigationBar change colors on push

一曲冷凌霜 提交于 2019-11-28 17:32:51
问题 I'm using 2 different bar tint colors at UINavigationBar in different views. I'n changing color with that method in both views: override func viewWillAppear(animated: Bool) { super.viewWillAppear(animated) self.navigationController?.navigationBar.barTintColor = COLOR } When I tap on back button color is not changed smoothly (you can see blink on last second). But everything is okay if just swipe view back instead of tapping on back button. How to make smooth transition in both situations? 回答1

Change the height of NavigationBar and UIBarButtonItem elements inside it in Cocoa Touch

不想你离开。 提交于 2019-11-28 17:21:45
问题 I suppose it's not strictly in line with Apple guidelines but I guess it must be possible somehow. I'd like to change the height of navigation bar inside UINavigationController and the height of UIBarButtonItem elements inside that bar. Using a trick from this question I managed to change the height of navigation bar but I can see no way of adjusting the height of bar button items. If anyone knows how to change the size of bar button items, please help me out. 回答1: Maybe this tutorial about a

How to set the title of a Navigation Bar programmatically?

会有一股神秘感。 提交于 2019-11-28 17:21:38
I have a Navigation Bar in a view, and I want to change its Navigation Item title programmatically. How is this done? In your UIViewController self.navigationItem.title = @"The title"; Swift 3 Version: If you use a navigation bar without navigation controller, then you can try this: navigationBar.topItem?.title = "Your Title" Hope for help. In viewDidLoad self.title = @"Title"; Wael Showair From Apple Documentation : The most common way to use a navigation bar is with a navigation controller. You can also use a navigation bar as a standalone object in your app. So If you have a

UINavigationBar Touch

回眸只為那壹抹淺笑 提交于 2019-11-28 17:13:42
问题 I would like to fire an event on touch when a user taps the title of the navigation bar of one of my views. I'm at a bit of a loss on whether I can access the view of the title of the UINavigationBar in order to wire up a touch event to it. Is this even possible? 回答1: The solution I found is a button, I use the following (but I don't know how "legal" it is): UIButton *titleLabelButton = [UIButton buttonWithType:UIButtonTypeCustom]; [titleLabelButton setTitle:@"myTitle" forState

Multiple UIBarButtonItems in UINavigationBar

柔情痞子 提交于 2019-11-28 16:43:46
How to Create multiple bar button in navigation bar? You must use UIToolbar and set the toolbar with buttons: // create a toolbar where we can place some buttons UIToolbar *toolbar = [[UIToolbar alloc] initWithFrame:CGRectMake(0, 0, 100, 45)]; [toolbar setBarStyle: UIBarStyleBlackOpaque]; // create an array for the buttons NSMutableArray *buttons = [[NSMutableArray alloc] initWithCapacity:3]; // create a standard save button UIBarButtonItem *saveButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSave target:self action:@selector(saveAction:)]; saveButton.style =

How do I add a Navigation Bar to a UITableViewController in Interface Builder?

删除回忆录丶 提交于 2019-11-28 16:41:22
问题 Interface builder does not let me click and drag a Navigation Bar onto a Table View Controller!!! It is super frustrating. All I want is a table view with an edit button (done in interface-builder). If this is not possible, then how do I add a navbar progammatically? Thanks in advance. 回答1: From the outline view, make sure your Table View Controller is selected. Then go to the Editor menu, and click on the Embed In submenu, and choose Navigation Controller and voila. You have your navigation

custom background image with large titles NavigationBar in iOS 11

好久不见. 提交于 2019-11-28 16:31:00
问题 How do you set a custom background image for the large title NavigationBar in iOS 11? I'm using a custom subclass which I've assigned to the navigationControllers in the storyboard. This is how I create my custom NavBar: class CustomNavigationController: UINavigationController { override func viewDidLoad() { super.viewDidLoad() // Do any additional setup after loading the view. self.navigationBar.tintColor = UIColor(red:1, green:1, blue:1, alpha:0.6) self.navigationBar.titleTextAttributes =