uinavigationcontroller

UINavigationController and autorotation

点点圈 提交于 2019-12-29 03:26:10
问题 I have a UIViewController that returns YES in shouldAutorotateToInterfaceOrientation: for UIDeviceOrientationPortrait and NO for everything else. With that view on the top of the stack, I use pushViewController:animated: to push a new UIViewController . The new controller returns YES for anything in shouldAutorotateToInterfaceOrientation: . The first view refuses to rotate (as expected). Once the second view is pushed, the user can rotate the device and the UI will rotate (also as expected).

Whose view is not in window hierarchy issue

浪子不回头ぞ 提交于 2019-12-28 16:14:06
问题 I've set up a navController, which appears after tapping a button. However, if I tap the button I get the error of: " Warning: Attempt to present <UINavigationController>: 0xab5d9d0 on <MyApp: 0xadaa320> whose view is not in the window hierarchy! " Does anyone know how to solve this? I also tried something on Stackoverflow but it wasn't my solution. Here my code for opening the navigationcontroller: I dont know if somebody know this photogallery but if you don't, here is the project. My code

navigationController.navigationItem vs navigationItem

﹥>﹥吖頭↗ 提交于 2019-12-28 06:27:14
问题 Just curious, why setting self.navigationItem = ... works, but self.navigationController.navigationItem fails? The same applies for self.toolbarItems vs self.navigationController.toobarItems . When to use self.navigationController.navigationItem ? Maybe you will say, they point to different things. but why self.navigationController.navigationBarHidden = YES the navigation bar is hidden. doesn't it means self.navigationController.navigationItem point to the bar i wanted? 回答1: The class

UINavigationController and UINavigationBarDelegate.ShouldPopItem() with MonoTouch

懵懂的女人 提交于 2019-12-28 06:01:49
问题 How do I pop up an UIAlertView when the back button of a UINavigationBar (controlled by a UINavigationController) was tapped? Under certain conditions, I want to ask the user an "Are you sure?" type of question so he could either abort the action and stay on the current view or pop the navigation stack and go to the parent view. The most appealing approach I found was to override ShouldPopItem() on UINavigationBar's Delegate. Now, there is a quite similar question here: iphone

iPhone Pushing View Controller in a left direction

北战南征 提交于 2019-12-28 05:43:11
问题 I have an app that has a centre view with two views off to each side of it. I want to have two navigation bar buttons, left and right which push a new navigation controller onto the view from the left or the right. When you change views by pushing a new view using the pushviewController: method of NavigationController, the view appears to slide in from the right. how do i change this to slide in from the left? 回答1: Instead of using a navigation controller, I would just move the view. CGRect

Disable swipe back gesture in Swift

孤者浪人 提交于 2019-12-28 03:29:08
问题 Been looking around on here for a while but can't seem to find a working solution. I'm trying to disable the swipe to go back to previous view gesture, in Swift. I've tried a variety of solutions including: self.navigationController?.interactivePopGestureRecognizer.enabled = false and self.navigationController.interactivePopGestureRecognizer.delegate = self func gestureRecognizerShouldBegin(gestureRecognizer: UIGestureRecognizer!) -> Bool { return false } Is there a new method of doing this

back button callback in navigationController in iOS

前提是你 提交于 2019-12-28 03:18:05
问题 I have pushed a view onto the navigation controller and when I press the back button it goes to the previous view automatically. I want to do a few things when back button is pressed before popping the view off the stack. Which is the back button callback function? 回答1: William Jockusch's answer solve this problem with easy trick. -(void) viewWillDisappear:(BOOL)animated { if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) { // back button was pressed. We know

iOS 13 UIBarButtonItem not clickable and overlapping UINavigationBars when using UISearchController

孤街醉人 提交于 2019-12-28 02:33:05
问题 I got a navigation bar containing some UIBarButtonItem buttons and a UISearchBar hooked up like this var searchController: UISearchController! override func viewDidLoad() { super.viewDidLoad() title = "Test" tableView.delegate = self tableView.dataSource = self searchController = UISearchController(searchResultsController: nil) navigationItem.searchController = searchController // This leads to the bug searchController.hidesNavigationBarDuringPresentation = false navigationItem

How to hide/show tab bar of a view with a navigation bar in iOS?

那年仲夏 提交于 2019-12-28 01:51:14
问题 I have views with a navigation bar and a tab bar. What I would like to happen is to hide the tab bar on a certain view and show the tab bar again when the user changes views. I saw a snippet of code for hiding the tab bar: -(void)makeTabBarHidden:(BOOL)hide { // Custom code to hide TabBar if ( [tabBarController.view.subviews count] < 2 ) { return; } UIView *contentView; if ( [[tabBarController.view.subviews objectAtIndex:0] isKindOfClass:[UITabBar class]] ) { contentView = [tabBarController

iOS App Freezes on PushViewController

帅比萌擦擦* 提交于 2019-12-27 22:09:06
问题 My navigation controller intermittently will freeze on push. It seems to add the new view controller onto the stack, but the animation never takes place. I also have two other containers that hold view controllers on the screen, and I can interact with both of them just fine after the navigation controller freezes. The really interesting thing is if I try to push another view controller onto the navigation controller's stack, I noticed that there is an extra view controller on top of the