UINavigationController 和 TabBarController 软件 /没有加热器/
目前我的文件 AppDelegate 包含此代码要安装 CustomTabBarController 作为 rootViewController:
我想要我的申请 CustomTabBarController 下面,但我希望导航控制器在每个选项卡上。 这是我用来配置我的代码 tabBarController:
这是我用来配置我的代码 FirstViewController:
window = UIWindow/frame: UIScreen.main.bounds/
window?.makeKeyAndVisible//
window?.rootViewController = CustomTabBarController//
我想要我的申请 CustomTabBarController 下面,但我希望导航控制器在每个选项卡上。 这是我用来配置我的代码 tabBarController:
class CustomTabBarController: UITabBarController {
override func viewDidLoad// {
super.viewDidLoad//
let vc1 = FirstViewController//
let vc2 = SecondViewController//
let vc3 = ThirdViewController//
viewControllers = [vc1, vc2, vc3]
}
这是我用来配置我的代码 FirstViewController:
class ProfileViewController: UIViewController, UICollectionViewDataSource, UICollectionViewDelegate, UICollectionViewDelegateFlowLayout {
func collectionView/_ collectionView: UICollectionView, numberOfItemsInSection section: Int/ -> Int {
return 2
}
func collectionView/_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath/ -> UICollectionViewCell {
let cell = collectionView.dequeueReusableCell/withReuseIdentifier: VCCellId, for: indexPath/ as! firstVCCell
return cell
}
}
没有找到相关结果
已邀请:
3 个回复
莫问
赞同来自:
和
s 正确调整它的方法是做
. 每个标签都是你的
得到你自己的
. 所以,如果你有 4 您创建的标签 4
.
请参阅部分:
https://developer.apple.com/li ... .html
更新
根据您添加到更新的问题的代码,创建
对于你的每一个
,
和
.
在你的每一个
s 安装
在选中此选项卡时要在导航窗格上显示的标题中:
快网
赞同来自:
就个人而言,我喜欢这种方法,因为他从一切中拯救了我的重复代码 ViewControllers 并保存导航条码 tab & 在您的用户类中组织 tab bar.
如果您不想在整个应用程序中使用相同的选项卡或导航面板设置,则可以在各自的类别中单独配置它们 ViewControllers. 但是,如果每个选项卡都有不同的属性 tab 和 / 或者 nav, 回答 Vacawama, 最有可能,这将是最好的方法!
风见雨下
赞同来自:
viewControllers = [vc1, vc2, vc3].map{UINavigationController/rootViewController: $0/}