uinavigationcontroller

How to set action to the backButtonItem on the navigation bar?

橙三吉。 提交于 2020-01-04 05:18:07
问题 How to set action to the backButtonItem on the navigation bar? I have a navigation bar, when I'm pressing the back button, I need to alert some message to the user, and only after user's reaction - return to the previous view. How can I do it? Thanx! - (void)viewDidLoad { [super viewDidLoad]; //no one field don't changed yet isDirty = FALSE; //edited user //set default values newData = [data copy]; //setting navigation controller rigth button UIBarButtonItem *rightButton = [[UIBarButtonItem

Create UIBarButtonItem with back button style

别来无恙 提交于 2020-01-04 04:00:32
问题 I'm looking for a way to create programmatically an UIBarButtonItem that looks like a back button of UINavigationBar . Apparently seems like that the back button appears only after a push on the UINavigationController . So I'm able to insert only a button with the "cancel" style. But my goal is to create a button with the "New Item" style. Ideas ? 回答1: the short answer is you cannot do it. you can save an image and you can put the image to that position, but the back button is managed by

Pushing a navigation controller is not supported error message

邮差的信 提交于 2020-01-03 18:13:39
问题 I am working on an app where the user has the possibility to add products and those products are then displayed in a TableView. I created a TableViewController with static cells and two sections and I want to hook the cell in the second section with another TableViewController. I dragged the TableViewController from the object library, embedded it in a navigation controller and made a push segue from the cell to the NavigationController but when I try to run the app I get the following error

How to set backButton text to empty?

孤街浪徒 提交于 2020-01-03 16:53:05
问题 I tried this code: navigationController?.navigationItem.backBarButtonItem?.title = "" but it does not work and did not change anything. How can I set backButton text to empty? 回答1: I tried this code for back button title. and it's work correctly let barButton = UIBarButtonItem() barButton.title = "" self.navigationController?.navigationBar.topItem?.backBarButtonItem = barButton 回答2: self.navigationController!.navigationBar.topItem!.title = "" 回答3: You should use: navigationItem

Navigation bar Hidden not working IOS

白昼怎懂夜的黑 提交于 2020-01-03 16:45:18
问题 Hi I'm new in iOS development. I've one main screen with navigation bar hidden true. From there I am navigating to another view using back segue. but when I click back it showing navigation bar on main screen. Here is my problem description. In main screen onviewload I am doing : self.navigationController.navigationBarHidden = YES; once user go to another view using back segue in new controller, I'm doing self.navigationController.navigationBarHidden = NO; And now, if I click back it will

'Cannot do a comparison query for type: (null)' when setting up UINavigationController

自作多情 提交于 2020-01-03 16:00:39
问题 My app is crashing in the app delegate. The error it's throwing is: Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Cannot do a comparison query for type: (null)' My code is below. I've left the logging statements in so you can see where I've been checking things: self.viewController = [[ParseStarterProjectViewController alloc] initWithNibName:@"ParseStarterProjectViewController" bundle:nil]; NSLog(@"View controller is %@",self.viewController);

Cannot Set Navigation Bar Font in Swift on Latest Xcode Version

久未见 提交于 2020-01-03 10:22:28
问题 The following code was running fine before updating to Xcode 6.1 to stay up with iOS 8.1: override func viewDidAppear(animated: Bool) { self.navigationController?.navigationBar.topItem?.title = "Home" self.navigationController?.navigationBar.titleTextAttributes = [ NSFontAttributeName: UIFont(name: "Lobster 1.4", size: 34), NSForegroundColorAttributeName: UIColor.whiteColor()] } The issue is specifically in NSFontAttributeName: UIFont(name: "Lobster 1.4", size: 34) and the error I'm getting

How do I turn off large titles for UINavigationBar?

安稳与你 提交于 2020-01-03 06:48:14
问题 I have a UITableView and a Detail View embedded in a UINavigationController as so: I would like to turn on large titles for "My Notes" but I'd like to turn it off for the detail view. Something like how the default Mail app works on iPhone. How would I change the navigation bar's prefersLargeTitle property during that segue? 回答1: it's very simple. In your DetailView you should set navigationItem.largeTitleDisplayMode to .never (not navigationController?.navigationItem.largeTitleDisplayMode !!

How to dismiss a view controller in a navigation controller, without dismissing the whole stack

…衆ロ難τιáo~ 提交于 2020-01-03 05:49:10
问题 Basically I have tab bar controller with two tabs, each holds a separate navigation controller, each with a couple of views (see below). In the "top" navigation controller (held in the right tab), I can choose an image, and then am taken to the rightmost screen to preview the image... func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { if let image = info[UIImagePickerControllerEditedImage] as? UIImage { let previewController =

how to pop a controller off the navigation stack without using the navigation bar

非 Y 不嫁゛ 提交于 2020-01-03 03:47:21
问题 I'm trying to implement a navigation controller with some hierarchical views. I want to use a regular UIViewController to present choices for drilling down, I don't want to use the navigation bar - I want to have my own, custom buttons for returning back up a level. I see examples like: [[self navigationController] pushViewController:nextViewController animated:YES]; and my questions are these: Is navigationController a property of all UIViewControllers? Can I refer to self