uinavigationitem

Placing a custom view based UIBarButtonItem in the navigation bar without default horizontal padding

China☆狼群 提交于 2019-11-28 19:46:44
问题 How do I remove the horizontal padding to the left and right of custom left and right UINavigationBar items? There seems to be ~ 10 points of padding that iOS sets by default. I'm customizing left and right navigation bar buttons (I have given up on trying to set my own backButtonItem, so I'm just using the leftBarButtonItem). In either case (left or right), pressing these custom buttons indicates that Apple seems to preserve some padding to the left of the leftBarButtonItem, and to the right

iPhone Title and Subtitle in Navigation Bar

半腔热情 提交于 2019-11-28 17:10:46
问题 In my application, I'd like to have the navigation bar display a title and subtitle. To that extent, I added the following code to my view controller: // Replace titleView CGRect headerTitleSubtitleFrame = CGRectMake(0, 0, 200, 44); UIView* _headerTitleSubtitleView = [[[UILabel alloc] initWithFrame:headerTitleSubtitleFrame] autorelease]; _headerTitleSubtitleView.backgroundColor = [UIColor clearColor]; _headerTitleSubtitleView.autoresizesSubviews = YES; CGRect titleFrame = CGRectMake(0, 2, 200

iOS开发UINavigation系列二——UINavigationItem

送分小仙女□ 提交于 2019-11-28 12:38:33
iOS开发UINavigation系列二——UINavigationItem 一、引言 UINavigationItem是导航栏上用于管理导航项的类,在上一篇博客中,我们知道导航栏是通过push与pop的堆栈操作来对item进行管理的,同样,每一个Item自身也有许多属性可供我们进行自定制。这篇博客,主要讨论UINavigationItem的使用方法。 UINavigationBar: http://my.oschina.net/u/2340880/blog/527706 。 二、来说说UINavigationItem Item,从英文上来理解,它可以解释为一个项目,因此,item不是一个简单的label标题,也不是一个简单的button按钮,它是导航栏中管理的一个项目的抽象。说起来有些难于理解,通过代码,我们就能很好的理解Item的意义。 首先,我们创建一个item,用UINavigationBar导航栏push出来: UINavigationItem * item = [[UINavigationItem alloc]initWithTitle:@"title"]; UINavigationBar * bar = [[UINavigationBar alloc]initWithFrame:CGRectMake(0, 0, 320, 64)]; [bar

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 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

Customize navigation bar with title view

天大地大妈咪最大 提交于 2019-11-28 06:15:55
I am trying to add a custom view in the center of a navigation bar and I am using the following code to test it: UIView * testView = [[UIView alloc] init]; [testView setBackgroundColor:[UIColor blackColor]]; testView.frame = CGRectMake(0, 0, 100, 35); [self.navigationController.navigationItem.titleView addSubview:testView]; I am setting this up in the viewDidLoad method of my view controller but when i run my program nothing seems to change in my navigation bar. Could you help me with this? This works. Give frame at the time of initialisation UIView *iv = [[UIView alloc] initWithFrame

iphone - Custom UIBarButtonItem for back button

人盡茶涼 提交于 2019-11-28 06:06:11
I am trying to use a custom item for the back button in my navigation bar. UIImage *backButtonImage = [UIImage imageNamed:@"backbutton.png"]; UIBarButtonItem *customItem = [[UIBarButtonItem alloc] initWithImage:backButtonImage style:UIBarButtonItemStylePlain target:nil action:nil]; [self.navigationItem setBackBarButtonItem: customItem]; [customItem release]; What I end up getting is my image with a border around it. It looks like this (My image is the back button): How can I get rid of the border? What am I doing wrong? Your image is appearing inside of a back button and it is apparently (from

Show search bar in navigation bar without scrolling on iOS 11

假装没事ソ 提交于 2019-11-28 04:03:55
I’m attaching a UISearchController to the navigationItem.searchController property of a UITableViewController on iOS 11. This works fine: I can use the nice iOS 11-style search bar. However, I’d like to make the search bar visible on launch. By default, the user has to scroll up in the table view to see the search bar. Does anyone know how is this is possible? Left: default situation after launch. Right: search bar made visible (by scrolling up). I’d like to have the search bar visible after launch, as in the right screenshot. I already found that the search bar can be made visible by setting

Add subtitle under the title in navigation bar controller in Xcode

爷,独闯天下 提交于 2019-11-28 03:28:35
So I'm wanting to add a "subtitle" under the title in the navigation bar in navigation controller. Mostly everything I look up so far wants me to use CGRect. I don't know a whole lot what that is and it sounds like its wanting me to create an entire new view which is not what I am wanting to do. My question is, is there a dot method to adding a subtitle view easily? The closest thing I found was posted on stack overflow and here is the link: Create a subtitle in navigationbar Apparently last year this worked but now I am getting errors and it's in my viewDidLoad... I tried this: self

How to Change back button title on navigation controller in swift3?

旧时模样 提交于 2019-11-28 02:13:30
I want to change the title of backbutton to any name in swift 3.I tried many ways but none of them worked for me. self.navigationItem.backBarButtonItem?.title="Title" self.navigationController?.navigationItem.backBarButtonItem?.title="Title" Just for information i have written below code in appdelegate. let backImage : UIImage = UIImage(named:"backArrow")! UINavigationBar.appearance().barTintColor = UIColor(red: 0.0/255.0, green: 0.0/255.0, blue: 0.0/255.0, alpha: 1.0) UINavigationBar.appearance().tintColor = UIColor.white UINavigationBar.appearance().backIndicatorImage = backImage