0
我想从景观变化的接口方向为纵向更改接口方向为纵向通过在cocos2dx V2 C++按下一个按钮,按下按钮
我想从景观变化的接口方向为纵向更改接口方向为纵向通过在cocos2dx V2 C++按下一个按钮,按下按钮
添加类变量
Bool isInLandsCapeOrientation;
在viewDidLoad中
使用这个标志
isInLandsCapeOrientation = false;
添加以下功能
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (!isInLandsCapeOrientation) {
return (UIInterfaceOrientationIsPortrait(interfaceOrientation));
}else {
return (UIInterfaceOrientationIsLandscape(interfaceOrientation));
}
}
从纵向改变方向为横向,让它发生在一个按钮动作
- (IBAction)changeOrientationButtonPressed:(UIButton *)sender
{
isInLandsCapeOrientation = true;
UIViewController *viewController = [[UIViewController alloc] init];
[self presentModalViewController:viewController animated:NO];
[self dismissModalViewControllerAnimated:NO];
}
您已经尝试了什么? – rishi