uinavigationitem

Set navbar item button to new title

。_饼干妹妹 提交于 2019-12-13 19:51:55
问题 Good day. I'm facing a weird issue, I'd like to set the right navigation item to Done in my next when I've selected a row. I tried it, and it's worked. But it's breaking however, because the function which implements the doneEditing body, is only in the next view controller, any help will be really appreciated. This is my code: override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) { if segue.identifier == "editContact" { let indexPath = tableView.indexPathForSelectedRow(

UINavigationController not popping UINavigationBar items on iPad

谁都会走 提交于 2019-12-13 18:32:30
问题 I'm having a very strange problem with the UINavigationController. I found a very similar question here: UINavigationController not popping UINavigationBar items but the solution there had to do with the fact that the guy had added a category to NSMutableArray, and I'm not doing anything like that. In short, the problem is this: I have a navigation controller and I'm pushing a few view controllers on it. Then when the 'back' button is tapped the view controller is popped, but the

Adding navigationItem.titleView in storyboard is failing

为君一笑 提交于 2019-12-13 12:02:21
问题 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

Change color of UIBarButtonSystemItemCancel

大兔子大兔子 提交于 2019-12-13 05:44:43
问题 If I use the UIBarButtonSystemItemCancel, it's color is set to that of the navigation bar. However, in the Photos App, the "Cancel" button is shown with a blue background. How can I also set the UIBarButtonSystemItemCancel to have a blue background please? 回答1: your can use image as button image as UIImage *buttonImage = [UIImage imageNamed:@"image.png"]; //create the button and assign the image UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom]; [button setImage:buttonImage

Method being called, but not executing properly

◇◆丶佛笑我妖孽 提交于 2019-12-13 04:19:15
问题 I have successfully chain linked delegate methods from CollectionViewController -> MenuTableViewController -> ListViewController . In ListViewController extension I call changeTitleView() but it is not working. The data, however is successfully passed because print(title) correctly prints passed information. changeTitle() executes properly if called from within ListViewController class ListViewController { var navigationTitle: String? @objc func changeTitle(title: String) { let titleLabel =

How do you determine the size/frame of a custom UINavigationItem.titleView?

Deadly 提交于 2019-12-12 08:53:46
问题 After creating a custom view and assigning it to the navigationItem.titleView property it is displayed like this with the custom view filling the space between the two buttons. Therefore, the custom view is not centered on the navigation bar. How do I determine the frame of the view in the .titleView property? I want to center some text in the navigation bar, say under the time stamp. 回答1: If you really want to get titleView 's frame (in your top-level view's coordinate space), you can do

How to add bar button to uinavigationbar in iphone

柔情痞子 提交于 2019-12-12 05:39:42
问题 My class is a normal view controller and I added a navigation bar through IB and i am adding a barbutton item on left to the navigation bar programmatically using the following code UIBarButtonItem *addButton1 = [[UIBarButtonItem alloc] initWithTitle:@"Start" style:UIBarButtonItemStylePlain target:self action:@selector(tourBtnClicked:)]; self.navigationItem.leftBarButtonItem = addButton1; but its not working... should i add the navigationbar also programmatically or should my class a

UINavigationBarItem programmatically

ぃ、小莉子 提交于 2019-12-12 03:07:30
问题 I have view controller which is inherited from UINavigationController . On viewDidLoad I want to set rightBarButtonItem . I do following. UINavigationItem* navItem = self.navigationItem; UIButton* btnOptionsView = [[UIButton alloc] init]; [btnOptionsView setImage:[UIImage imageNamed:@"options.png"] forState:UIControlStateNormal]; [btnOptionsView sizeToFit]; UIBarButtonItem* btnOptions = [[UIBarButtonItem alloc] initWithCustomView:btnOptionsView]; navItem.rightBarButtonItem = btnOptions; but

Back button is not showing in navigation bar?

烈酒焚心 提交于 2019-12-11 18:49:43
问题 I,m building an article read app for iPad and using split view controller. Master view contains menu list and detail view controller contains list of article. Clicking on list of articles it opens in a new view and i’m using a segue and navigation controller to connect detail view controller and Next view in which article opens. Segue with Modal style.I’m facing a problem there is no back button when article opens in a next view. 回答1: The article view is being presented modally, so there is

Where is UINavigationItem disappearing to when refactoring views to storyboard?

若如初见. 提交于 2019-12-11 16:35:51
问题 I'm rewriting an Obj-C project using Swift 4 / Xcode 9.2 I have a large storyboard that I am breaking down into multiple storyboards. I did this previously without any issues. If I refactored a few views to their own storyboard then the views took the navigation item with them. now they disappear... [ My questions are ... Is this an Xcode bug? or a new feature? Obviously you can work around this as I have shown in the pictures but is there a way to stop the vanishing from happening? 回答1: This