Tag: uinavigationbar

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

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

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

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

导航栏更改高度

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

如何在导航栏上添加文本

如何在导航栏或工具栏上添加助理文本。 就像这个邮件应用程序,我想要一个大的导航栏,上面有一些文字标题。 我应该使用导航栏还是使用工具栏,我应该如何实现这一点。

UINavigationBar外观和Facebook的表错误

我在我的appdelegate中使用下面的代码: UINavigationBar *navigationBar = [UINavigationBar appearance]; [navigationBar setBackgroundImage:[[UIImage imageNamed:@"top_bar"] stretchableImageWithLeftCapWidth:5 topCapHeight:5] forBarMetrics:UIBarMetricsDefault]; [navigationBar setBackgroundImage:[[UIImage imageNamed:@"top_bar_scape"] stretchableImageWithLeftCapWidth:5 topCapHeight:5] forBarMetrics:UIBarMetricsLandscapePhone]; 一切工作正常,但我有一个奇怪的错误,当我打开iOS6的Facebook共享表,并打开观众列表(或专辑列表无关紧要):导航栏与我的top_bar-Image呈现。 请参阅以下屏幕: < – 正常没有我的外观变化 我的外观改变了 任何想法如何避免这个错误? 谢谢! 🙂

更改UIDocumentInteractionController上的NavigationBar背景

我必须从UIWebView将本地PDF文件(文档目录)传递给其他应用程序(iBooks,Facebook Messenger,WhatsApp,…)。 所以我使用UIDocumentInteractionController: – (IBAction)shareButton:(id)sender { NSURL *url = [NSURL URLWithString:self.webView.request.URL.absoluteString]; self.docController = [UIDocumentInteractionController interactionControllerWithURL:url]; self.docController.delegate = self; [self.docController presentOpenInMenuFromBarButtonItem:sender animated:YES]; } 如果我selectFB Messenger或WhatsApp,它会显示一个ViewController。 如何更改此VC(背景图像/颜色,button色调)的NavigationBar外观? 默认白色半透明会很好。 我在AppDelegate中设置了一个NavigationBar背景图片。

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

可以说,我有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 […]

将UICollectionView添加到NavigationBar

我想添加一个UICollectionView作为一个子视图到我的NavigationBar。 [self.navigationController.view addSubview:self.hotspotCollectionView]; 它似乎正常工作,但覆盖后退button,请参阅附加的屏幕截图。 有无论如何缩进collectionView,以便返回button是正确的可见? 还有一种方法来增加导航栏的高度,所以我可以在我的CollectionView中使用更大的缩略图图片? 我正在使用XCode 7和iOS9。

如何在IOS5中自定义UINavigationBar

在IOS5中,我还不知道如何自定义UINavigationBar。 我的代码是这样的: [[UINavigationBar appearance] setBackgroundColor:[UIColor colorWithWhite:0.5f alpha:1.0]]; [[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys: [UIColor blackColor],UITextAttributeTextColor ,[UIColor blackColor], UITextAttributeTextShadowColor ,[NSValue valueWithUIOffset:UIOffsetMake(0, 0)], UITextAttributeTextShadowOffset ,[UIFont fontWithName:@"Arial" size:20.0],UITextAttributeFont , nil]]; // Customize UIBarButtonItems UIImage *gradientImage44 = [[UIImage imageNamed: @"title__bg.png"] resizableImageWithCapInsets:UIEdgeInsetsMake(0, 0, 0, 0)]; [[UINavigationBar appearance] setBackgroundImage:gradientImage44 forBarMetrics:UIBarMetricsDefault]; [[UIBarButtonItem appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor whiteColor],UITextAttributeTextColor ,[UIColor whiteColor], UITextAttributeTextShadowColor ,[NSValue valueWithUIOffset:UIOffsetMake(0, 0)], UITextAttributeTextShadowOffset ,[UIFont […]

Swift:Tableview在导航栏下滚动,但在状态栏之上?

我用下面的技巧隐藏了导航栏的阴影: self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) self.navigationController?.navigationBar.shadowImage = UIImage() 我也有以下设置: self.extendedLayoutIncludesOpaqueBars = true self.automaticallyAdjustsScrollViewInsets = true self.tabBarController?.tabBar.isHidden = true 在我的页面上,一切看起来都不错,除了当我滚动我的tableView它按预期在导航栏下,但在状态栏上方: 我如何确保tableView在导航栏和状态栏下滚动?