2
我用下面的代碼爲IO6及以下強制旋轉:IOS 7 +對於力控制方向爲縱向
-(void) viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
UIApplication* application = [UIApplication sharedApplication];
if (application.statusBarOrientation != UIInterfaceOrientationPortrait)
{
UIViewController *c = [[UIViewController alloc]init];
[c.view setBackgroundColor:[UIColor redColor]];
[self.navigationController presentViewController:c animated:NO completion:^{
[self.navigationController dismissViewControllerAnimated:NO completion:^{
}];
}];
}
}
但它不是在IOS7正常工作,其旋轉視圖控制器,但重新設置空白視圖在屏幕上......
你能幫助我在IOS 7解決這個問題...
嗨..這是工作......但以前的觀點仍處於Lancape模式時,我回去就可以和以前的觀點interfaceOrientation = 4,statusBarOrientation = 1,這是不同的。任何解決方案... – Hindu
@kokx應該以前的觀點不支持景觀?我不完全確定你在說什麼= 4和= 1,也許使用助記符?你可以嘗試在前一個視圖中實現旋轉代表? – Austin
是的,已經做了,但是當我回來,委託功能shouldAutorotate和supportedInterfaceOrientations,不叫...... – Hindu