Im пишу приложение, которое я хотел бы отображать различные виды на основе ориентации. Например, если устройство представляет собой портретную нагрузку pView, если пейзаж загружается lView. Ниже приведен код, который в настоящее время используется.IPad вращения, любой способ загрузить пользовательский вид на основе ориентации?
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)
interfaceOrientation duration:(NSTimeInterval)duration {
if (interfaceOrientation == UIInterfaceOrientationPortrait)
{
self.view = portrait;
}
else if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown){
self.view = portrait;
}
else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight){
self.view = portrait;
}
else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft){
self.view = landscape;
}
}
С этим я создал 2 мнения в IB и подключены выходы для правого ракурса. Ive также попытался это:
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)
interfaceOrientation duration:(NSTimeInterval)duration {
if (interfaceOrientation == UIInterfaceOrientationPortrait)
{
self.view = portrait;
}
else if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown){
self.view = portrait;
}
else if (interfaceOrientation == UIInterfaceOrientationLandscapeRight){
lView *abo = [[lView alloc] initWithNibName:@"lView" bundle:nil];
[self.navigationController pushViewController:abo animated:NO];
[abo release];
}
else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft){
lView *abo = [[lView alloc] initWithNibName:@"lView" bundle:nil];
[self.navigationController pushViewController:abo animated:NO];
[abo release];
}
}
код непосредственно выше работал ставку, но не IPad. Есть идеи?
Нет, я пытаюсь загрузить другой вид, основанный на ориентации. – Tanner