Tag: uinavigationcontroller

UIScrollView在将视图推送到UINavigationController后停止工作

如果我把东西推到导航控制器,然后回到主页面,我的主页面的滚动视图停止工作。 如果我重新打开应用程序而不向导航控制器推送任何东西,它正常工作。 滚动视图是延伸到框架外的水平滚动视图。 我使用它来滚动浏览button,就像在iOS中切换应用程序(iOS多任务)一样。 这是我推新vc的代码 UIViewController *newVC = [[UIViewController alloc] init]; UILabel *label = [[UILabel alloc] initWithFrame:self.view.bounds]; [label setTextAlignment:NSTextAlignmentCenter]; label.text = [NSString stringWithFormat:@"promo %i detail view",[sender tag]]; label.backgroundColor = [UIColor whiteColor]; [newVC.view addSubview:label]; [self.navigationController setNavigationBarHidden:NO animated:NO]; [self.navigationController pushViewController:newVC animated:YES]; 当视图控制器被popup,导航控制器移回主页面时,我隐藏了导航条。 – (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated { if(viewController == self){ [self.navigationController setNavigationBarHidden:YES]; NSLog(@"%d", [self.scrollMenuBar isScrollEnabled]); […]

NavigationBar IOS中的SearchBar

我尝试使用导航栏大标题,并添加search栏导航控制器。 search栏显示在导航标题下。 它应该隐藏,直到我刷下来。 我明白,默认行为是隐藏的,除非我设置“navigationItem.hidesSearchBarWhenScrolling = false”。 即使我添加“navigationItem.hidesSearchBarWhenScrolling = true”,它不起作用。 我创build了一个新的应用程序来testing这个function。 它embedded了ViewController和Navigation Controller。 以下是我的代码: class ViewController: UIViewController { let searchController = UISearchController(searchResultsController: nil) override func viewDidLoad() { super.viewDidLoad() navigationController?.navigationBar.prefersLargeTitles = true navigationItem.searchController = searchController // navigationItem.hidesSearchBarWhenScrolling = true } }

WkWebView实例化中的内存泄漏

我有一个ViewController,其中包含wkwebview当我从导航控制器popup它我得到内存泄漏 堆栈跟踪导致WkWebview实例化 我也没有使用任何代表。 我真的想知道是什么原因造成的,以及如何解决这个问题

为每个屏幕自定义NavigationController的后退button

我一直在尝试UINavigationController类的子类来修改背景图像,导航栏大小,后退button,字体等等。 几个小时后,大量的阅读我明白,我不应该inheritanceUINavigationController类… 我想有具体的devise和将devise转移到使用我的自定义NavigationController的所有屏幕… 到目前为止,我还没有为此提供任何优雅的解决scheme,大多数解决scheme都是基于configuration仅在下一个屏幕中显示的内容(下一个视图)。 我怎样才能做到这一点? 也许使用类别? 提前致谢。

如何在一些视图上更改UINavigationBar背景图像,但不是全部?

我想设置一个图像作为UINavigationController背景,但我发现大多数解决scheme应用导航栏中的所有视图背景。 你能给一些可能有帮助的代码吗? Thx帮助, 斯特凡

为什么我的UITabBar在纵向加载时向下移动20个像素?

我正在UINavigationController加载UITabBarController 。 默认情况下, UITabBar的UITabBarController将它放在视图的底部。 通过使用默认选项,在横向启动应用程序时,该栏将在底部正确显示。 这也使肖像正确显示在底部,(但只有当横向模式启动应用程序)。 如果我以纵向方式启动应用程序,则会在两个横向上向下移动状态栏的高度: 和肖像: 我正在尝试与CNBC应用程序产生类似的效果,并在视图顶部显示UITabBar 。 在回顾了Mihai Damian的问题之后,我试图自定义UITabBar。 我只是简单地添加了几行代码: -(void)loadView{ UIView *contentView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]]; contentView.backgroundColor = [UIColor clearColor]; self.view = contentView; [contentView release]; orderingTabBarController = [[UITabBarController alloc] init]; OrderingSpecialsViewController *specialsViewController = [[OrderingSpecialsViewController alloc] initWithNibName:@"OrderingSpecialsViewController" bundle:nil]; OrderingProductViewTabBarController *productViewTabBarController = [[OrderingProductViewTabBarController alloc] init]; OrderingSummaryViewController *summaryViewController = [[OrderingSummaryViewController alloc] init]; […]

使用UINavigationController边缘滑动时,CABasicAnimation会重置

我有以下CABasicAnimation在我的viewDidLoad运行一个UINavigationController的视图控制器: CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"]; animation.duration = 1; animation.additive = NO; animation.removedOnCompletion = NO; animation.fillMode = kCAFillModeForwards; animation.fromValue = [NSNumber numberWithFloat:0]; animation.toValue = [NSNumber numberWithFloat:-1*(((-windBearing+180) * M_PI) / 180)]; [compass.layer addAnimation:animation forKey:@"90rotation"]; 当我使用边缘轻扫手势慢慢地回溯,animation重置到初始状态,这是相当不和谐的。 我有我的fillMode设置和removedOnCompletion设置为NO ,我错过了什么?

导航栏更改高度

当我把我的UIViewController从我以前的控制器中推到屏幕上时,它会改变这个变化。 但是,当它完成加载它的大小我的导航栏和跳跃转换使它看起来不好。 我怎样才能解决这个问题? 我所做的只是在viewWillAppear隐藏控制器A中的导航栏,并在viewDidLoad中的控制器B中显示它。

hidesBottomBarWhenPressed在返回ViewController时没有设置

我有我的UIViewController(称为ViewControllerA)被推入到我的UINavigationController堆栈之一的hidesBottomBarWhenPushed = true设置。 我也select在ViewControllerA的ontop上显示bottomBar。 所以我有: class ViewControllerA: UIViewController { override func viewWillDisappear(animated: Bool) { self.hidesBottomBarWhenPushed = false } override func viewWillAppear(animated: Bool) { self.hidesBottomBarWhenPushed = true } 这一切工作正常。 当我推ViewControllerA,底部栏隐藏。 当我推任何其他的ViewController,底部栏显示。 但是,当我在导航堆栈中向后行进(又名UIBarButtonItemBackbutton)时,popup导航堆栈以显示ViewControllerA时,无法隐藏bottomBar。 我错过了什么? 谢谢!

交互式转换:导航栏外观问题

可以说,我有3个视图控制器: A , B , C ,全部embedded到导航控制器中。 A和B有一个导航栏, C没有。 我有一个自定义的B和C之间的交互转换。 因为我需要我的导航栏消失在C ,我实现了UINavigationControllerDelegate这个function: func navigationController(_ navigationController: UINavigationController, willShow viewController: UIViewController, animated: Bool) { if viewController is C { navigationController.setNavigationBarHidden(true, animated: animated) } else { navigationController.setNavigationBarHidden(false, animated: animated) } } 当我只进行push-pop转换时,一切都可以在一个普通的场景中完美运行。 但是,当我通过调用UIPercentDrivenInteractiveTransition上的cancel()来取消转换B – > C ,导航栏不会显示在B 。 在这里,我必须调用setNavigationBarHidden(false, …) ,但是我没有设法find正确的位置来做到这一点。 如果我在B的viewWillAppear调用它,会出现一个导航栏,但看起来真的很奇怪 – 它包含了C会拥有的导航栏的元素。 如果我弹回到A ,它会闪烁片刻并显示预期的内容,但在过渡之后, A导航栏将被B导航栏取代! 所以,似乎导航栏堆栈在B […]