我用按钮和图像设计我的笔尖在陆地景观模式,但在模拟器中它以横向模式显示但按钮和图像不是在笔尖上看起来,它们看起来在右侧而不是在最佳?请指点。 笔尖图像
答案 0 :(得分:0)
如果您希望此视图控制器仅限于视图控制器类中的某个方向使用
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}
请在此处阅读我的回答Keep iPhone rotation in landscape?
答案 1 :(得分:0)
使用此代码
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
NSLog(@"Landscape Mode");
// your code when your sdk is in landscape mode
}
else
{
NSLog(@"Portrait Mode");
// your code here
}
}
答案 2 :(得分:0)
如何在界面构建器中设计视图(纵向/横向)不会影响它实际显示的方式。您需要在代码中(或可能在p列表中)设置它。