이 (내가 결코 생각하지)입니다 거의 이미 초기화 된 객체에 init
를 호출하지, 올바른 방법이 아니다.
난이 문제를 해결하는 방법은,은 UINavigationController의 서브 클래스를 생성하는 것이다. 이 서브 클래스에서
은, 내가 그것을 아이폰 OS가 rootviewcontroller를 설정하는 가능성을 가지고 있지에 대한 해결의의
initwithrootviewcontroller:
- (id) initWithRootViewController:(UIViewController *)rootViewController
{
UIViewController *fakeController = [[[UIViewController alloc] init] autorelease];
self = [super initWithRootViewController:fakeController];
if(self)
{
self.fakeRootViewController = fakeController;
rootViewController.navigationItem.hidesBackButton = YES;
[self pushViewController:rootViewController animated:NO];
}
return self;
}
fakeRootViewController 실제로 아무것도하지 않는 덮어 씁니다.
또 다른 함수 (setRootViewController : aViewController)에서는 새로운 'rootviewcontroller'의 백 버튼을 숨기므로 사용자는 위조 된 rootviewcontroller를 보지 못합니다. 다음 poptorootviewcontroller가 있는지 항상이없이 배열을 반환 있도록 viewcontrollers의 게터 변경해야 스택의 인덱스 1이 아니라 인덱스 0
에 나올 수 있도록 덮어 써야
fakerootviewcontroller 위로 밀어 fakerootviewcontroller (removeobjectatindex: 0
)이 도움이
희망!
감사 Costique을 확인해야합니다! 작동 중입니다. setViewController가 어떻게 작동하는지 설명해 주시겠습니까? –
두 가지 방법 모두 탐색 컨트롤러 내부의 전체보기 컨트롤러 스택을 대체합니다. "오래된"컨트롤러가 출시됩니다. 스택 배열은 루트 컨트롤러로 시작하고 마지막 요소는 최상위 뷰 컨트롤러입니다. – Costique
@Costique 어떻게 루트를 설정할 수 있습니까? 루트를 3 번 변경해야만이 방법이 효율적으로 작동 할 것인가? – Dalvik