加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Swfit 学习 简单UI

发布时间:2020-12-15 20:03:31 所属栏目:百科 来源:网络整理
导读://创建window self.window = UIWindow(frame:UIScreen.mainScreen().bouns) //设置根VC self.window!.rootViewController = ViewController() //创建一个btn var btn = UIButton (frame: CGRect (x:? 100 ,y:? 100 )) // 设置背景颜色 ? ?btn.backgroundColo

//创建window

self.window = UIWindow(frame:UIScreen.mainScreen().bouns)


//设置根VC

self.window!.rootViewController = ViewController()


//创建一个btn

var btn = UIButton (frame:CGRect(x:?100,y:?100))


// 设置背景颜色

? ?btn.backgroundColor = UIColor.yellowColor();

?? ? ? ?

?// 将添加到我们的vc上

self.window!.rootViewController!.view.addSubview(btn)

?? ? ? ?

self.window!.makeKeyAndVisible()



//创建window?

? ? ? ??self.window?=?UIWindow(frame:UIScreen.mainScreen().bounds)

? ? ? ??VC

? ? ? ??let? vc =?ViewController()

? ? ? ??let?oneVc =?OnrViewController()

? ? ? ??let?two =?TwoViewController()

? ? ? ??let?three =?ThreeViewController()

? ? ? ??let?four =?FourViewController()

?? ? ? ?

? ? ? ??设置背景颜色

? ? ? ? vc.view.backgroundColor?=?UIColor.redColor()

? ? ? ? vc.title?=?"SwiftDemo"

? ? ? ? vc.tabBarItem.title?= vc.title

?? ? ? ?

? ? ? ? oneVc."2"

? ? ? ? oneVc.greenColor()

? ? ? ? oneVc.title?= oneVc.title

?? ? ? ?

? ? ? ? two."3"

? ? ? ? two.blueColor()

? ? ? ? two.title?= two.title

?? ? ? ?

? ? ? ? three."4"

? ? ? ? three.brownColor()

? ? ? ? three.title?= three.title

?? ? ? ?

? ? ? ? four."123"

? ? ? ? four.purpleColor()

? ? ? ? four.title?= four.title

? ? ? ??nav

? ? ? ??let?nav1 =?UINavigationController(rootViewController:vc)

? ? ? ??let?nav2 =?UINavigationController(rootViewController:oneVc)

? ? ? ??let?nav3 =?UINavigationController(rootViewController:two)

? ? ? ??let?nav4 =?UINavigationController(rootViewController:three)

? ? ? ??let?nav5 =?UINavigationController(rootViewController:four)

?? ? ? ?

? ? ? ??let?tabber =?UITabBarController()

? ? ? ? tabber.tabBar.tintColor?=?whiteColor()

? ? ? ? tabber.viewControllers?= [nav1,nav2,nav3,nav4,nav5]

?? ? ? ?

? ? ? ??设置window的根vc

? ? ? ??window!.rootViewController?= tabber

? ? ? ??window!.makeKeyAndVisible()

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读