ios7横竖屏适配
2013-12-15 20:55
501 查看
/** * 根据当前屏幕方向,重新定义view的frame * * @param orientation 屏幕方向 * * @return 适配后的frame */ - (CGRect)frameForOrientation:(UIInterfaceOrientation)orientation { CGRect frame; if (orientation == UIInterfaceOrientationLandscapeLeft || orientation == UIInterfaceOrientationLandscapeRight) { CGRect bounds = [UIScreen mainScreen].bounds; frame = CGRectMake(bounds.origin.x, bounds.origin.y, bounds.size.height, bounds.size.width); } else { frame = [UIScreen mainScreen].bounds; } return frame; }
//ios7- (BOOL)shouldAutorotate{return YES;}//支持的方向- (NSUInteger)supportedInterfaceOrientations{return UIInterfaceOrientationMaskAll;}- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation{return YES;}- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation duration:(NSTimeInterval)duration{CGRect frame = [self frameForOrientation:interfaceOrientation];self.webView.frame = frame;//重新定义frame}
相关文章推荐
- ios NSFileManager创建目录、文件
- iOS开发之多媒体播放
- iphone iOS7恢复到iOS6教程
- IOS 导航栏的 一些用法
- iOS 关于枚举的使用
- iOS xcode编译错误no such product type for the 'iphonesimulator' platform
- ios 入门之Hello World
- iOS多线程编程之Grand Central Dispatch(GCD)介绍和使用
- iOS多线程编程之NSThread的使用
- ios各种动画效果
- iOS更改应用显示名称
- iOS开发中常用函数及控件
- IOS中图片相关操作(读取、保存、绘制、其它相关)
- IOS代理浅析
- IOS中NSTimer使用及runloop
- IOS开发之程序首次启动时加载关于程序应用的简介
- IOS中如何限制TextField中输入的类型以及长度
- ios ViewController 页面跳转
- iOS 画圆弧或扇形
- iOS解析HTML