Tag: uinavigationcontroller

Swift – 以编程方式导航到另一个视图控制器/场景

在从第一个视图控制器导航到第二个视图控制器时,我收到了一条错误消息。 我的编码是这样的 let vc = LoginViewController(nibName: "LoginViewController", bundle: nil) self.navigationController?.pushViewController(vc, animated: true) 问题是我总是得到这种错误信息 2014-12-09 16:51:08.219 XXXXX[1351:60b] *** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Could not load NIB in bundle: 'NSBundle </var/mobile/Applications/FDC7AA0A-4F61-47E7-955B-EE559ECC06A2/XXXXX.app> (loaded)' with name 'LoginViewController'' *** First throw call stack: (0x2efcaf0b 0x39761ce7 0x2efcae4d 0x31b693f9 0x31ac1eaf 0x3191e365 0x317fe895 0x318a930d 0x318a9223 0x318a8801 0x318a8529 0x318a8299 0x318a8231 […]

iOS:popViewController出乎意料的行为

我一直在寻找一个解决scheme的互联网。 我找不到任何东西 所以:我正在使用UINavigationController。 我推着两个UIViewControllers到它。 在第二个推ViewController我执行此代码: – (void)reverseGeocoder:(MKReverseGeocoder *)geocoder didFailWithError:(NSError *)error { NSLog([error localizedDescription]); [self.navigationController popViewControllerAnimated:YES]; } 预期发生的事情是,最后推送的ViewController消失。 在这个应用程序,我在less数地方这样做,它在这个非常的ViewController的任何地方都能正常工作。 会发生什么是只有后退button离开屏幕(animation),但其他一切保持在屏幕上。 在控制台输出中,当这条线执行时,两个东西被打印出来: 2011-03-14 16:32:44.580 TheAppXY [18518:207]嵌套的stream行animation会导致导航栏损坏 2011-03-14 16:32:53.507 TheAppXY [18518:207]完成处于意外状态的导航转换。 导航栏子视图树可能会损坏。 两条错误消息我找不到任何信息。 我正在使用XCode 4和iOS SDK 4.3。 也许任何人都可以帮助我解决这个问题。

如何以编程方式在UINavigationController中按“返回”button

我有一个名为FriendsViewController UINavigationController内的UIViewController 。 第二个叫做FriendsDetailedViewController UIViewController 。 从第一个视图控制器导航到第二个时,我想以编程方式在需要时按下“ Backbutton。 这个怎么做?

NSGenericException“,原因是:只有在源控制器由UINavigationController实例pipe理时,才能使用Push segues

所以我使用5个视图控制器的应用程序,第一个embedded在一个UINavigationController和前四个视图控制器之间的inheritance工作正常。 然而,介绍第五视图控制器打破了这一点,我得到的错误 Terminating app due to uncaught exception 'NSGenericException', reason: 'Push segues can only be used when the source controller is managed by an instance of UINavigationController.' 我没有做任何不同的事情,这个第五视图控制器,它只是一个标准的视图控制器与图像视图和一个标签,所有我的segues调用ctrl拖动故事板中的button。 有没有人知道这是什么原因? 谢谢

通过initWithRootViewController以外的方法设置UINavigationController的rootViewController

如何通过initWithRootViewController以外的方法设置UINavigationController的rootViewController ? 我想使用initWithNavigationBarClass:toolbarClass:为我的NavigationController提供一个自定义的工具栏,所以我不认为我可以使用initWithRootViewController 。

在UINavigationController中隐藏导航栏时不会滑回

我喜欢从UINavigationController中embedded视图inheritance的swipe包。 不幸的是,我似乎无法find一种方法来隐藏导航栏,但仍然有触摸平移轻扫手势。 我可以编写自定义手势,但是我宁愿不要依赖于UINavigationController反滑动手势。 如果我在故事板中取消选中,则后滑动不起作用 或者如果我以编程方式隐藏它,相同的情况。 – (void)viewDidLoad { [super viewDidLoad]; [self.navigationController setNavigationBarHidden:YES animated:NO]; // and animated:YES } 有没有办法隐藏顶部导航栏,仍然有刷卡?

从导航堆栈中删除viewcontrollers

我有一个导航堆栈,说5个UIViewControllers。 我想通过点击第五个viewcontroller中的一个button来删除堆栈中的第三个和第四个viewcontroller。 是否有可能做到这一点? 如果这样怎么样?

有没有办法改变故事板中的UINavigationBar的高度,而不使用UINavigationController?

我想在我的一个视图中使用自定义的UINavigationBar ,这不是任何UINavigationController -hierarchy的一部分。 当我将一个UINavigationBar拖入Storyboard时,它显示如下: 这个栏是44px,如果状态栏不能共享这个空间就足够了。 由于iOS7允许我们使用整个屏幕,包括状态栏的空间, UINavigationBar应该是64px高,而不是44px。 如果我将视图连接到一个UINavigationController的层次结构,那么它显示正确的: 我读了一个地方, 如果 UINavigationBar的属性barPosition:设置为UIBarPositionTopAttached ,那么栏将是64px。 但是,这是一个readonly属性。 我的search结果只显示了一些我认为是“解决方法”的内容。 通过在这个UIViewController之前添加一个无用的UINavigationController ,我可以假装有一个层次结构,它将自动添加64像素的UINavigationBar 。 是否真的没有办法有一个'stream氓'(没有导航控制器的帮助下)覆盖64px的UINavigationBar ? 如果是这样的话,有什么合理的理由呢? (我不是说默认情况下UINavigationBar应该是64px,但是在检查器中应该有一个选项) (我也看到有人用程序化的方式来解决这个问题,尽pipe这些答案很有效,但是我还是要devise一个故事板(差距),我想知道的是如果可以设置的话故事板,或者说,为什么不允许?)

如何在iOS中使用导航栏隐藏/显示视图的标签栏?

我有导航栏和标签栏的意见。 我想要发生的是隐藏在某个视图上的标签栏,并在用户更改视图时再次显示标签栏。 我看到了隐藏标签栏的代码片段: -(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.view.subviews objectAtIndex:1]; } else { contentView = [tabBarController.view.subviews objectAtIndex:0]; } if (hide) { contentView.frame = tabBarController.view.bounds; } else { contentView.frame = CGRectMake(tabBarController.view.bounds.origin.x, […]

检查视图控制器是以模态方式呈现,还是推送到导航堆栈上

我如何在我的视图控制器代码中区分: 以模态方式呈现 推在导航堆栈上 在这两种情况下presentingViewController isMovingToParentViewController和isMovingToParentViewController都是YES ,所以不是很有帮助。 什么复杂的事情是,我的父视图控制器有时是模态的,要检查的视图控制器被推送。 事实certificate,我的问题是,我embedded我的HtmlViewController在一个UINavigationController然后提出。 这就是为什么我自己的尝试和下面的好答案不起作用。 HtmlViewController* termsViewController = [[HtmlViewController alloc] initWithDictionary:dictionary]; UINavigationController* modalViewController; modalViewController = [[UINavigationController alloc] initWithRootViewController:termsViewController]; modalViewController.modalTransitionStyle = UIModalTransitionStyleCoverVertical; [self presentViewController:modalViewController animated:YES completion:nil]; 我想我最好告诉我的视图控制器,当它是模态,而不是试图确定。