【转载】iOS开发之屏幕旋转
来源:互联网 发布:oracle sql创建表 编辑:程序博客网 时间:2024/05/24 07:03
1. iOS有四个方向的旋转,为了保证自己的代码能够支持旋转,我们必须首先处理一个函数:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
returnYES;
}
2. 这个函数时用来确定我们的应用所支持的旋转方向。如果想要支持每个方向则直接返回YES就行,还可以单独判断某一方向:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if(interfaceOrientation==UIInterfaceOrientationLandscapeLeft) {
//left
}
if(interfaceOrientation==UIInterfaceOrientationLandscapeRight) {
//right
}
if(interfaceOrientation==UIInterfaceOrientationPortrait) {
//up
}
if(interfaceOrientation==UIInterfaceOrientationPortraitUpsideDown) {
//down
}
returnYES;
}
3. 当然旋转还有一些函数可触发:
//旋转方向发生改变时
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
}
//视图旋转动画前一半发生之前自动调用
-(void)willAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
}
//视图旋转动画后一半发生之前自动调用
-(void)willAnimateSecondHalfOfRotationFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation duration:(NSTimeInterval)duration {
}
//视图旋转之前自动调用
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
}
//视图旋转完成之后自动调用
-(void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation {
}
//视图旋转动画前一半发生之后自动调用
-(void)didAnimateFirstHalfOfRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation {
}
本文固定链接: http://istar.name/blog/ios-development-rotation
阅读全文
0 0
- 【转载】iOS开发之屏幕旋转
- iOS开发之屏幕旋转
- iOS开发之屏幕旋转
- iOS开发 -- 屏幕旋转
- IOS开发 - 屏幕旋转
- iOS开发屏幕旋转解决方案
- IOS(iphone,ipad,itouch)开发 之 屏幕旋转
- IOS开发之——手动设置屏幕旋转
- IOS开发之——手动设置屏幕旋转
- iOS开发笔记之代码控制屏幕旋转
- iPhone开发之屏幕旋转
- 转载 -- IOS成长之路-关于iOS6.0 屏幕旋转的问题
- ios开发 旋转屏幕supportedInterfaceOrientationsForWindow函数概要
- iOS开发:关于屏幕旋转问题
- 【iOS界面开发】UIWindow屏幕旋转自适应
- iOS - 强制旋转屏幕之代码实现
- 安卓开发之屏幕旋转
- iOS开发之图片旋转
- UIScrollView的详细讲解(转)
- HTTP状态码301、404、200、304
- UITableView(转)
- CAD版本转换器转换文件的方法
- 使用iOS手势UIGestureRecognizer(转)
- 【转载】iOS开发之屏幕旋转
- java学习第44天,hashCode
- UIView翻转效果实现(转)
- ios开发视图切换效果动画类CATransition
- ArrayList源码
- NSDictionary类使用(转)
- iOS ARC(转)
- ios开发-推送通知(转)
- iOS开发——keychain的使用(转)