나는 이것을 작동 시키려고 노력하는 지난 몇 시간을 보냈다. 그래서 나는 내가하려고하는 것이 정확한지 알 필요가 없다. 그것 미쳤던 그 운전!UIViewController와 오리엔테이션은 올바른 방향으로 가고 있습니까?
내 목표는 방향 변경을 감지하는 ViewController를 사용하는 것입니다. 그것이 인물 일 때 UITableView를 사용하여 뷰를 보여줍니다. 가로로 표시하면 프로그래밍 방식으로 만들 컨텐트가있는 UIView가 표시됩니다. 내가 가진의 ViewController 내 부모에
:
- (void)viewDidLoad
{
[super viewDidLoad];
TableDataViewController *tableDataController = [[TableDataViewController alloc]
initWithNibName:@"TableDataViewController"
bundle:nil];
self.tableDataViewController = tableDataController;
[self.view insertSubview: tableDataController.view atIndex:0];
[tableDataController release];
}
이 테이블보기와 함께 간다 컨트롤러를 포함하는 내 시야를로드합니다. 그런 다음 사용자는 장치와 기능을 회전합니다.
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toOrientation
duration:(NSTimeInterval)duration
{
if (toOrientation == UIInterfaceOrientationPortrait) {
NSLog(@"PerformAnalysisViewController: Gone to Potrait");
}
if ((toOrientation == UIInterfaceOrientationLandscapeLeft) ||
(toOrientation == UIInterfaceOrientationLandscapeRight)) {
NSLog(@"PerformAnalysisViewController: Gone to Landscape");
// Load new view here
CGRect frame = [[UIScreen mainScreen] applicationFrame];
UIView *horizView = [[[HorizView alloc]
initWithFrame:frame] autorelease];
[self setView:horizView];;
}
}
에 따라 트리거됩니다. 그러나 그것은 발동하지 않습니까? 컨트롤이 viewDidLoad에 삽입 한 Subview로 전달 되었기 때문입니까? 그렇다면 어떻게 다시 얻을 수 있습니까? 오리엔테이션을 감지하고 슈퍼 뷰에서 자신을 삭제해야합니까?
만약 그게 작동했다면 위와 같이 새 뷰를 추가 할 수 있습니까? Apple 설명서를 읽으려고했지만이 작업을 수행 할 수 없습니다.
모든 도움을 주시면 감사하겠습니다.
마이크
shouldAutorotateToInterfaceOrientation : interfaceOrientation을 구현 했습니까? –