首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 其他教程 > 操作系统 >

怎么修正iOS6下Oritentation的有关问题

2014-07-14 
如何修正iOS6上Oritentation的问题1.将addSubview修改为setRootViewController[window addSubview: viewCo

如何修正iOS6上Oritentation的问题

1.将addSubview修改为setRootViewController

[window addSubview: viewController.view];
修改如下:

if ( [[UIDevice currentDevice].systemVersion floatValue] < 6.0){    // warning: addSubView doesn't work on iOS6    [window addSubview: viewController.view];}else{    // use this mehod on ios6    [window setRootViewController:viewController];}

2.修改shouldAutorotateToInterfaceOrientation

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {    return UIInterfaceOrientationIsLandscape( interfaceOrientation );}

iOS6以前会呼叫这方法来判断手机是垂直或打横

// For ios6, use supportedInterfaceOrientations & shouldAutorotate instead of shouldAutorotateToInterfaceOrientation- (NSUInteger) supportedInterfaceOrientations{    return UIInterfaceOrientationMaskLandscape;}- (BOOL) shouldAutorotate {    return YES;}

iOS6需在加上上面方法


2楼Phantomio昨天 18:31
ъ(?Д?)GJ!!
1楼BeyondVincent昨天 15:12
1.1

热点排行