iPhone 为所有视图控制器提供一个标题

iPhone one title for all view controllers(iPhone 为所有视图控制器提供一个标题)
本文介绍了iPhone 为所有视图控制器提供一个标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个带有标签栏控制器(带有 4 个视图控制器)的应用程序,它包含一个导航控制器.所有这些都是以编程方式创建的.我的问题:有没有办法为所有视图控制器设置一个导航栏标题?例如:当我切换标签时,标题是相同的.对我来说理想的解决方案是在应用程序委托文件中设置标题.非常感谢

I have an app with tab bar controller (with 4 views controller) and it contains a navigation controller. All of this was create programmatically. My question: Is there a way how to set one navigation bar title for all view controllers ? For example: When i switch tabs, title is the same. Ideal solution for me is set title in app delegate file. Thanks a lot

推荐答案

如果你知道会有 4 个视图控制器,那就做 self.title = @"your title"; 如果你想要更改您的标题"一次并将它们全部更改,只需创建一个静态全局或使用 plist.并将代码放在 viewDidAppear 下,以便每次刷新.不需要做任何太复杂的事情:)

If you know that there will be exactly 4 views controller, just do self.title = @"your title"; If you want to change "your title" once and have them all changed, just create a static global or use plist. And put the code under viewDidAppear so that it refreshes every time. No need to do anything too complex :)

这篇关于iPhone 为所有视图控制器提供一个标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Pushing UIViewController above UITabBar(将UIView控制器推送到UITabBar上方)
java.lang.IllegalStateException: SimpleTypeImpl should not be created for error type(异常:不应为错误类型创建SimpleTypeImpl)
Android IllegalArgumentException: The tag for fragment_XXX is invalid. Received: layout-sw600dp/fragment_XXX_0(Android IlLegalArgumentException:Fragment_XXX的标签无效。收到:Layout-sw600dp/Fragment_XXX_0)
iOS convert audio sample rate from 16 kHz to 8 kHz(IOS将音频采样率从16 kHz转换为8 kHz)
Enforcing an audio sampling rate in iOS(在iOS中强制音频采样率)
HTTPS request using volley(使用 volley 的 HTTPS 请求)