uinavigationitem

backBarButtonItem gets renamed in iOS 7 when there is a long title

倖福魔咒の 提交于 2019-12-04 03:05:43
One behavior I observed in iOS 7 is that the title of the backBarButtonItem of a UINavigationItem get's renamed if the title of the currently displayed view controller is too long. Too lazy to explain so here are some photos: As you can see, when the title is too long, the back button gets renamed to "Back" regardless of what it was previously. If the title is even longer, the back button doesn't show any text, just the left arrow image. Does anyone know how to disable this behavior? I would like the back button to stay exactly what I want it to be and not get renamed. Thanks EDIT I created a

Adding navigationItem.titleView in storyboard is failing

喜夏-厌秋 提交于 2019-12-04 02:37:06
I can add a titleView to my navigationItem very easily in code: UIImageView *navImageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"nav_logo"]]; UIView *titleView = [[UIView alloc] initWithFrame:navImageView.frame]; [titleView addSubview:navImageView]; self.navigationItem.titleView = titleView; However, I'm trying to do this within my storyboard, and am failing miserably. Here's what I've done: Drag and drop a UIView on top of my VC's Navigation Item. Drag and drop a UIImageView on top of the UIView Add width/height/leading/top constraints Set the image property of the

IOS - toolbar is not appearing on top

末鹿安然 提交于 2019-12-04 02:16:08
问题 i have asked this question here also but i didn't get any solution.so i am asking here again with the full explanation. I downloaded EPub Reader library from here. When i run this library,first comes a table view which contain four rows having values EPUB ,PDF etc and after clicking on the "EPUB" row book appears successfully with the top toolbar. Because i have to load the book first in start instead of showing the toolbar i did some changes with the code. copied some code from

Restoring navigationItem.title after removing navigationItem.titleView

对着背影说爱祢 提交于 2019-12-04 02:08:44
My App has 2 tabs ( tabA and tabB ), based on location the I set the navigationItem.titleView of tabB to a UIImageView when - viewWillAppear: is called. The default behaviour of tabB is to simply display a title, e.g: The issue is when the location changes and I remove the UIImageView navigationItem.titleView (using - removeFromSuperview ), the default title has also disappeared and trying to set it with: self.navigationItem.title = @"TITLE"; Does not work. Any ideas on how to solve this? Simply setting: navigationItem.titleView = nil; Will restore the text title. 来源: https://stackoverflow.com

UISegmentedControl, UIToolbar and UINavigationItem

时间秒杀一切 提交于 2019-12-04 01:18:34
I've create a UISegmentedControl and successfully attached it to my navigationItem.tableView. But when I try instead to attach it to a UIToolbar, it blows up. I'm sure I've seen UISegementedControls on toolbars before - but can't seem to get it working. Thoughts? // works NSArray *statusItems = [[NSArray alloc] initWithObjects:@"one", @"two", nil]; statusSegments_ = [[UISegmentedControl alloc] initWithItems:statusItems]; self.navigationItem.titleView = statusSegments_; // doesn't work NSArray *statusItems = [[NSArray alloc] initWithObjects:@"one", @"two", nil]; statusSegments_ = [

How do I get the width of the back button in a UINavigationBar?

你说的曾经没有我的故事 提交于 2019-12-03 14:15:34
问题 We have a controller that might be pushed from several places, so its back button might have one of several titles. It also has a button that pops up another controller. They both have the same custom title element, but they're centred differently because the second controller has no back button. I'd like to add a spacer to fix this, but I don't know what width to make it. How do I get the width of the back button in a UINavigationBar? 回答1: You could always spelunk through the navigation bar

iOS 11 - UINavigationItem titleView when using Large Titles mode

☆樱花仙子☆ 提交于 2019-12-03 13:21:09
问题 I'm trying to understand either it's a bug or it's the expected behavior. On iOS 10 and earlier we could set up a custom title, using navigationItem.titleView . On iOS 11 , when setting our navigationItem.largeTitleDisplayMode = .always and setting navigationItem.titleView = <Some cool UIButton> it's displaying both the normal navigation title bar and the large navigation title. Illustration: To sum up: How can we use custom titleView on our Large Navigation Title? EDIT : This is the expected

hide and show left navigation bar button on demand in iOS-7

落爺英雄遲暮 提交于 2019-12-03 12:51:05
I added my left navigation bar button using the storyboard. but I want it to hide when I first load the screen. And then in response to something else, I want it to show. The navigation bar has a method for hiding the back button. But there is no method for hiding/showing the left button. Is there a simple way for doing this? Or do I have to use two methods: the hiding method creates an empty button and the showing method creates the correct button? The button in question is just the Add template that iOS provides (which makes it easy to just use the one in the storyboard than to create my own

How to hide/disable only the first uinavigationbar?

六月ゝ 毕业季﹏ 提交于 2019-12-03 11:34:24
I've been wandering how to hide / remove / disable only the main or first navigation bar in the navigation controller so that I could put an image as a whole background screen but I couldn't find any solution. Did try hide the titleview in viewdidLoad of the main navigation controller but didn't work. Tried using navigationBarHidden but it hides the whole navigation bar for the next stack of controller. So, I'm not sure how to do this. To give you an example, I would like to have something like this app - The Masters Golf Tournament - http://appshopper.com/sports/the-masters-golf-tournament .

UINavigationItem titleView position

送分小仙女□ 提交于 2019-12-03 10:34:48
I'm using UINavigationItem's titleView property to set a custom UILabel with my desired font size/color. Here's my code: self.headerLabel = [[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, 400.0, 44.0)]; self.headerLabel.textAlignment = UITextAlignmentCenter; self.headerLabel.backgroundColor = [UIColor clearColor]; self.headerLabel.font = [UIFont boldSystemFontOfSize:20.0]; self.headerLabel.textColor = [UIColor colorWithRed:0.259 green:0.280 blue:0.312 alpha:1.0]; self.navigationItem.titleView = self.headerLabel; In the navigation bar I also have a left bar button. The result is this: alt