Swift开发iOS App学习笔记(一)---AppIcon & LaunchScreen

Swift开发iOS App学习笔记(一)—AppIcon & LaunchScreen

Taylor Guo, 2017年9月16日


LaunchScreen

需要准备一个图片,实际上是同一幅图片的不同分辨率,所以最好是一副分辨率比较大的图片,比如尺寸为1024,iOS会加载进去。

iOS8之后苹果推荐推荐使用Launch File,而不是Launch Image。

iOS8之后就会在Xcode里面看到Launchscreen.storyboard。


Tab Bar

ESTabBarController Github

这里写图片描述

UITabBarController是容器视图控制器,它包含了一个或多个视图控制器。另外两个容器是Navigation Controller和Split View Controller。

容器关系是用箭头来表示。

参考资料

iOS From Scratch With Swift: Exploring Tab Bar Controller


StoryBoard

运行APP的时候,UIApplication将Tab Bar Controller作为主屏幕构建并运行。如果超过5个屏幕,它会自动地得到More..。

添加Table View Controller

添加的屏幕都是Tab Bar controller - UIViewController的实例。可以用UITabViewController替换tab screen。点击第一个view controller的边框,删掉。拖一个新的Table View Controller到画布上。

然后,用Navigation controller替换Tab View Controller。选中Tab View Controller,在菜单中选择Editor\Embed In \Navigation Controller。这会添加一个controller到画布上。

这里写图片描述

也可以从对象控制器中拖一个Navigator controller过来。

这里写图片描述

Prototype Cells可以轻松设计tab view cell的布局。
选择cell,在Attributes inspector中设置style为subtitle。

这里写图片描述

这里写图片描述


GCD

这里写图片描述

这里写图片描述


代码和智能提示(自定义MainViewController)

这里写图片描述



参考资料

OC-Tab Bar-iOS开发UI篇—UITabBarController简单介绍

Swift - 标签条(UITabBar)标签页控制器(UITabBarController)用法

iOS From Scratch With Swift: Exploring Tab Bar Controller

一篇较为详细的 Storyboard使用方法 总结



参考资料

Swift - 修改顶部状态栏(statusBar)文字颜色为白色


StoryBoard

View Controller在Storyboard上叫“scene”,scene表示view controller在storyboard上。

一个单一的view controller包含一个空视图。

这里写图片描述

应用程序如何加载?

打开AppDelegate.swift

这里写图片描述

AppDelegate类的@UIApplicationMain属性是模块的入口。如果使用storyboard,应用程序从UIResponder继承一个UIWindow属性。所有的方法都是空的。application(_:didFinishLaunchingWithOptions:)也返回true。

info.plist


Swift4

错误问题
Declarations in extensions cannot override yet error

解决方法

参考资料

Declarations in extensions cannot override yet error in Swift 4

Limiting @objc inference

[swift-evolution] [Proposal draft] Limiting @objc inference

The Swift Programming Language (Swift 4) - Extensions


Swift4

错误问题
Initializer does not override a designated initializer from its superclass

解决方法

参考资料

从 Swift 初始化说起

正确编写Designated Initializer的几个原则

Initializer does not override a designated initializer from its superclass


Apple官网- UIButton

Swift - 按钮(UIButton)的用法

Swift,UIButton,addTarget

Swift - 按钮(UIButton)的用法

UIButton常用属性和函数详解


获取屏幕尺寸

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值