Tag: uinavigationcontroller

在单独的View Controller上使用scrollViewDidScroll时,无法更改UINavigationBar的样式

我在UINavigationControllerembedded了三个视图控制器。 FirstViewController导航到SecondTableViewController ,导航到ThirdDetailViewController 。 我遇到的问题是当使用scrollViewDidScroll方法自定义status bar和UINavigationBar的风格时,它也覆盖堆栈中的其他视图控制器以及所有状态栏样式。 有谁知道我可以如何防止scrollViewDidScroll方法影响堆栈中的其他视图控制器? FirstViewController override func viewWillAppear(animated: Bool) { UIApplication.sharedApplication().statusBarStyle = .Default self.navigationController?.navigationBar.setBackgroundImage(UIImage(), forBarPosition: .Any, barMetrics: .Default) self.navigationController?.navigationBar.shadowImage = UIImage() self.navigationController?.navigationBar.backgroundColor = UIColor.whiteColor() self.navigationController?.navigationBar.tintColor = UIColor.blackColor() self.navigationController?.navigationBar.barTintColor = UIColor.whiteColor() self.navigationController?.navigationBar.translucent = true } SecondTableViewController 我改变了导航的风格,取决于用户滚动了多less,以融入或脱离内容。 其他视图控制器的样式将更改为方法中设置的任何样式。 override func scrollViewDidScroll(scrollView: UIScrollView) { let color = colorWheel() if (scrollView.contentOffset.y > -60) { UIApplication.sharedApplication().statusBarStyle […]

防止UINavigationBar popViewControlleranimation

我有以下问题:我已经覆盖popViewControllerAnimated:(BOOL)animated的UINavigationController因为我想有一个自定义的animation。 代码如下: – (UIViewController *)popViewControllerAnimated:(BOOL)animated { UIViewController *poppedCtrl = [super popViewControllerAnimated:NO]; [((customViewController *) self.topViewController) doCustomAnimation]; return poppedCtrl; } 不幸的是, UINavigationBar似乎忽略了我明确禁用内置的animation,它仍然是animation。 我还需要做些什么来防止导航栏的animation呢?

UINavigationController:呈现视图控制器,同时closures另一个控制器正在iPad上进行

我有一个观点,要求用户login。当用户试图打开该视图,他没有login,我会打电话给他的login视图login,他完成后,我会打电话给他原来的意见,他打算查看。 在iPhone上,这工作正常,因为我推视图控制器。 但在iPad上,我呈现视图控制器这是行不通的。 它说解雇正在进行中,不能显示新的控制者。 这里是代码: – (void) buttonPressed { if (!userLoggedIn) { // userLoggedIn getter calls new screens of login if needed return; // this is executed if user declined to login } MyViewController *temp = [[MyViewController alloc] init]; [self.navigationController presentViewController:temp animated:YES]; // this returns warning that dismissal in progress and does not work } […]

iOS 7 UINavigationBar有隐藏的后退button

我有一个应用程序,它的UINavigationBars中有一个自定义图像的后退button。 在iOS 6中,一切都很好,但在iOS 7中,button在大多数情况下是“隐形”的。 当我将一个新的视图控制器推入UINavigationController时,后面的button不会出现在新的屏幕上,但是如果我触摸button的位置,它会淡入。 如果我在导航控制器上设置了两个没有animation的视图控制器,那么button显示正常,但不会出现以后的推送。 我敢肯定,在我的代码中没有什么是故意隐藏后退button,并改变UINavigationBar上提供的各种颜色没有任何区别。

iOS 7没有调用supportedInterfaceOrientations

我search了这个答案,但找不到解决我的问题的任何东西。 所以这里的问题是:我有一个自定义的UINavigationController,创build它时在rootViewController上调用supportedInterfaceOrientations方法(只支持肖像)。 但是当把另一个ViewController推入堆栈时,这个方法在被推送的ViewController上不会被调用(支持所有的倒置)。 我通过在viewDidLoad方法中调用[self supportedInterfaceOrientations]来解决它,但是我认为这不是解决问题的好方法。 我希望你能在这个问题上帮助我。 这是我在第二个viewController中实现的代码。 – (BOOL)shouldAutorotate { return YES; } – (NSUInteger)supportedInterfaceOrientations { if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPhone) { [[[UIApplication sharedApplication] delegate] setGlobalOrientationMask:UIInterfaceOrientationMaskAllButUpsideDown]; return UIInterfaceOrientationMaskAllButUpsideDown; } else { [[[UIApplication sharedApplication] delegate] setGlobalOrientationMask:UIInterfaceOrientationMaskAll]; return UIInterfaceOrientationMaskAll; } } 我认为johnma的解决scheme应该可以适用于大多数应用程序,但在我的情况下,我认为有一个特殊的问题,但我现在自己解决(不知道它是否是一个好的,但它的工作原理)。 我实现了- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated在我的navigationController委托的- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated方法。 – (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController […]

iPhone模态视图animation帮助

我没有做过多的animation,我需要一些帮助。 我有一个tabBarController作为我的根控制器,我想要另一个tabBarController ,我想把它作为一个模态视图控制器,我有一个animation的问题。 目前有四个modalViewControllersanimation,即 typedef enum { UIModalTransitionStyleCoverVertical = 0, UIModalTransitionStyleFlipHorizontal, UIModalTransitionStyleCrossDissolve, UIModalTransitionStylePartialCurl, } UIModalTransitionStyle; 我想要一个不同的animation – 从右到左滑动。 – 我怎样才能做这个animation? 任何帮助? 编辑: 我的想法推tabBarController到导航堆栈糟透了! 苹果对这种做法的评论: 您从不想将标签栏控制器推到导航控制器的导航堆栈上。 这样做会造成一种不寻常的情况,只有当特定的视图控制器位于导航堆栈的顶部时,标签栏才会出现。 标签栏被devise为持久的,所以这种瞬态方法可能会让用户感到困惑。 我没有想法。 有人帮我模态视图控制器的animation。

当用户点击行时,表格视图在导航栏下滑动

我有一个UINavigationController (NC)包含一个UITableViewController (TVC0)。 当用户点击一行时,它会加载一个UIPageViewController (PVC),它在其他UITableViewController (TVC1)之间来回切换。 TVC0显示在NC内部(意味着它不隐藏在顶部的导航栏或底部的标签栏后面)。 当它推动PVC时,第一个TVC1出现在导航栏和标签栏的边界内。 但是,当我滑动,里面的TVC1s隐藏在导航栏和标签栏后面。 我可以拉来揭示内容,但是当我释放时,它会回到酒吧后面。 我怎么能强迫一切出现在两个酒吧之间? 我不能使用故事板(因为它是一个传统的应用程序)和embedded…选项不可用。 [编辑] 我添加了一些日志logging,发现我的embedded式TVC1帧的绝对原点为0,64,但是一旦我点击,它就会变为0,0。如果我找不出一个真正的解决scheme,我总是可以伪造它通过加64,但我更想知道什么是错的。 [/编辑] [更多编辑] 我正在testingiOS 6模拟器的另一个区域,发现这个分页在iOS 6中完美无缺。所以我看到的问题是iOS 7的特定问题。 [/更多] 这里是我的TVC0 viewDidLoad ,PVC pageViewController:viewControllerBeforeViewController:和一个帮手viewControllerAtIndex: :: – (void) viewDidLoad { [super viewDidLoad]; NSDictionary* options = [NSDictionary dictionaryWithObject: [NSNumber numberWithInteger: UIPageViewControllerSpineLocationMin] forKey: UIPageViewControllerOptionSpineLocationKey]; self.pageController = [[UIPageViewController alloc] initWithTransitionStyle: UIPageViewControllerTransitionStyleScroll navigationOrientation: UIPageViewControllerNavigationOrientationHorizontal options: options]; self.pageController.dataSource = self; […]

presentModalViewController什么都不做

我有一个UIViewController( 父 )调用presentModalViewController与另一个UIViewController( 子 ) viewDidLoad 。 如果父级没有UINavigationController,那么presentModalViewController什么也不做。 如果它有一个UINavigationController,则presentModalViewController按预期显示子项 。 这是presentModalViewController的标准行为还是有其他的东西在这里玩?

UINavigationController方法setToolbarHidden在Xcode 9中的bug:自动布局约束的无限计算导致OOM

我有一个嵌套在UITabBarController的UINavigationController实例。 我使用导航控制器来达到一些视图控制器(标签栏仍然可见),从中我继续到第二个视图控制器(标签栏不再可见)。 在第二个视图控制器中,只要我调用: [self.navigationController setToolbarHidden:NO]应用程序冻结和内存增长,直到OOMexception崩溃。 我承认,不推荐在导航栏中embedded导航控制器,但是这个设置在iOS 11之前似乎没问题。 编辑:当停止执行,我看到很多电话: UIView(UIConstraintBasedLayout) UIView(AdditionalLayerSupport) NSLayoutConstraint 这是完整的堆栈跟踪 * thread #1, queue = 'com.apple.main-thread', stop reason = signal SIGSTOP * frame #0: 0x0000000106dd895c libobjc.A.dylib`objc_msgSend + 28 frame #1: 0x00000001067b6b9b Foundation`-[NSConcreteMapTable removeObjectForKey:] + 138 frame #2: 0x00000001069e6019 Foundation`_substituteOutAllOccurencesOfBodyVar + 1282 frame #3: 0x00000001067f3c5b Foundation`-[NSISEngine tryAddingDirectly:] + 144 frame #4: 0x00000001067f332f Foundation`-[NSISEngine tryToAddConstraintWithMarker:expression:integralizationAdjustment:mutuallyExclusiveConstraints:] […]

呈现以iPad iOS 6为中心的视图控制器时出错

在iOS 5中,它正确运行: PinRequiredViewController *pinView = [[PinRequiredViewController alloc]initWithNibName:@"PinRequiredView" bundle:nil]; UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:pinView]; // show the navigation controller modally navController.modalPresentationStyle = UIModalPresentationFormSheet; navController.modalInPopover = NO; navController.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; [self presentViewController:navController animated:YES completion:nil]; navController.view.superview.frame = CGRectMake(0, 0, 250, 250); navController.view.superview.center = self.view.window.center; 但在iOS6中不能正常工作,视图不会保留在屏幕上,包括纵向和横向。 任何解决scheme 谢谢!! 🙂