【发布时间】:2014-08-09 11:02:53
【问题描述】:
如何在ios中锁定风景。我尝试了很多方法但没有成功,任何人都可以分享锁定风景的最新代码。
-(void) portraitLock {
BSEAppDelegate* appDelegate = [UIApplication sharedApplication].delegate;
appDelegate.screenIsPortraitOnly = true;
}
- (NSUInteger) application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window
{
return UIInterfaceOrientationMaskPortrait;
}
+(BOOL)shouldAutorotate
{
return NO;
}
-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
【问题讨论】:
-
当你想要风景时为什么要返回
UIInterfaceOrientationMaskPortrait?据我所知,shouldAutorotate需要是实例方法(-),而不是类方法(+)。 -
我返回 No 和 Yes.,这也不起作用..,我会怎么做?你能告诉我吗?
-
嗨,巴韦什。是不是要锁孔应用。是单页
-
那段代码我试过但没有用。,
标签: ios iphone ios7 ios6 orientation