IOS Swift3.1 手工代码编写主视图
来源:互联网 发布:ios上传图片java接收 编辑:程序博客网 时间:2024/06/04 18:26
1. 普通页面控制器
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.main.bounds)
window?.rootViewController = ViewController()
window?.backgroundColor = UIColor.white
window?.makeKeyAndVisible()
return true
}
2. 使用导航控制器
var NavCtr : UINavigationController?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
// Override point for customization after application launch.
window = UIWindow(frame: UIScreen.main.bounds)
NavCtr = UINavigationController(rootViewController: ViewController() )
NavCtr?.setNavigationBarHidden(true, animated: false)//隐藏导航条,看起来像普通控制器
window?.rootViewController = NavCtr
window?.backgroundColor = UIColor.white
window?.makeKeyAndVisible()
return true
}
3. 使用Tab页
var window: UIWindow?
var TabBar: UITabBarController?
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool {
window = UIWindow(frame: UIScreen.main.bounds)
window?.backgroundColor = UIColor.white
window?.makeKeyAndVisible()
TabBar = UITabBarController()
window?.rootViewController = TabBar
let v1 = VC1()
let v2 = VC2()
let v3 = VC3()
let v4 = VC4()
v1.tabBarItem.title = "t1"
v2.tabBarItem.title = "t2"
v3.tabBarItem.title = "t3"
v4.tabBarItem.title = "t4"
TabBar?.addChildViewController(v1)
TabBar?.addChildViewController(v2)
TabBar?.addChildViewController(v3)
TabBar?.addChildViewController(v4)
TabBar?.tabBar.isHidden = true //隐藏tab按钮,看起来像是普通页面
// TabBar?.selectedIndex = 1 //代码中切换页面的方式
return true
}
- IOS Swift3.1 手工代码编写主视图
- IOS swift3.1 创建Swift空工程(无storyBoard)纯代码方式编写APP
- 手工编写测试代码(C#)
- 输入校验--手工编写代码实现
- Struts2手工编写表单验证代码
- 手工编写SSH应用1
- IOS Swift3.1保存数据
- IOS Swift3.1 删除UIViewController
- Struts框架之手工编写代码方式实现校验
- iOS代码编写规范
- IOS基础控件 UILabel swift3.1
- IOS基础控件 UIButton swift3.1
- IOS基础控件 UIImageView swift3.1
- IOS基础控件 Layer swift3.1
- IOS基础控件 UISwitch swift3.1
- IOS Swift3.1 手动页面跳转
- IOS Swift3.1 打印视图生命周期
- IOS Swift3.1 打印系统所有字体
- android studio Session 'app': Error Installing APK解决方法
- iOS集成极光推送 生产环境收不到推送消息
- Spring读取配置文件的方式
- 服务发现过程分析
- Android
- IOS Swift3.1 手工代码编写主视图
- Android 表情功能实现,封装面板方便使用
- 关于vbA等项目出现计算机无法加载项目处理方法。
- Ubuntu 中软件的安装、卸载以及查看的方法总结
- [vim] H M L G
- 轻松实现分页指示器 ViewPagerIndicator Android自定义控件
- 全国省市区数据SQL
- 20. OP-TEE中TA与CA执行流程-------CA部分的代码篇
- Spring IOC原理与源码分析