That's a demo about how to change orientation of the iPhone smoothly
This repo focus on usage of:
- Orientation rotation
- Basic Project Structure
- Custom Button on TabBar
- Using Block
- Simple App Icon
屏幕旋转的整个流程是如下
- 当 当前设备方向属性
orientation
发生变化时候,会调用Controller
的shouldAutorotate
属性。 - 如果
shouldAutorotate
为true
则会进一步调用supportedInterfaceOrientations
来查询支持的屏幕方向。 - 当
Controller
支持的方向和设备方向一致时候就进行旋转操作。
- 横屏时使用
UIAlertController
会导致该错误,解决方法:添加UIAlertController
的category
重写- (BOOL)shouldAutorotate
方法
//UIApplicationInvalidInterfaceOrientation
Supported orientations has no common orientation with the application,
and [UIAlertController shouldAutorotate] is returning YES
- 横屏进入首页时的一个Bug (打开了锁屏开关,不锁屏)
I am an iOS developer and currently learning Swift.