使用TabBarController(代码实现)

时间:2023-03-09 13:33:27
使用TabBarController(代码实现)

step01:使用Xcode创建一个项目

使用TabBarController(代码实现)

step02:填写项目必要信息

使用TabBarController(代码实现)

step03:检查文件结构树是否正确

使用TabBarController(代码实现)

step04:创建一些类,这些类将会在后面用到!(选择Swift File)

使用TabBarController(代码实现)

step05: 填写类的名字

使用TabBarController(代码实现)

step06:再次检查目录树,是否增加了刚才创建的类文件。

使用TabBarController(代码实现)

step07: 进入BlueColor.swift文件进行编辑

使用TabBarController(代码实现)

step08:接下来,进入AppDelegate.swift文件,编辑如下代码

使用TabBarController(代码实现)

step09:编译运行

使用TabBarController(代码实现)

很显然,我们并没有看出TabBarController的作用在哪!所以需要继续。。。

step10:再重复4~7步

分别建立RedColor,YellowColor,

step11:修改AppDelegate.swift文件

使用TabBarController(代码实现)

step12:编译运行,观察变化

使用TabBarController(代码实现)

step13:我们发现item上面的文字并不是我们想要的,我们需要的是BlueColor 而不是Featured ...

使用TabBarController(代码实现)

step14:编译运行,

使用TabBarController(代码实现)

step15:如何提示用户消息到达数量

使用TabBarController(代码实现)

step16:编译运行,

使用TabBarController(代码实现)