0
我工作的一個iPhone應用程序,我想創造縱向視圖和橫向視圖獨立的佈局。在縱向佈局中,我有2列3行方形按鈕(這是在界面生成器中用xib完成的)。在景觀我想有3列2行。這可能嗎?我添加了下面的代碼,我認爲可以爲此工作。創建單獨的縱向和橫向佈局的iPhone
- (void)willAnimateRotationToInterfaceOrientation:
(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
toInterfaceOrientation == UIInterfaceOrientationLandscapeRight)
{
NSLog(@"Landscape Rotation Occurred");
scriptureButton.frame = CGRectMake(20, 20, 130, 130);
characterSketchButton.frame = CGRectMake(170, 20, 130, 130);
mapButton.frame = CGRectMake(320, 20, 130, 130);
storyingButton.frame = CGRectMake(20, 170, 130, 130);
videoButton.frame = CGRectMake(170, 170, 130, 130);
otherResourcesButton.frame = CGRectMake(320, 170, 130, 130);
}
else
{
NSLog(@"Portrait Rotation Occurred");
scriptureButton.frame = CGRectMake(20, 20, 130, 130);
characterSketchButton.frame = CGRectMake(170, 20, 130, 130);
mapButton.frame = CGRectMake(20, 170, 130, 130);
storyingButton.frame = CGRectMake(170, 170, 130, 130);
videoButton.frame = CGRectMake(20, 320, 130, 130);
otherResourcesButton.frame = CGRectMake(170, 320, 130, 130);
}
}
感謝您的建議。我去了Collection View,這是我之前考慮過的。 – James