문제

다른보기 컨트롤러에서 임시 슬라이드 인을로드하려고합니다. 내 응용 프로그램의보기 컨트롤러는 구성되어 있습니다.

Application > Tab Bar Controller > TabBarItem > View Controller

이보기 컨트롤러에는 임시보기를로드하는 메소드를 성공적으로 발사하는 버튼이 있습니다.

- (IBAction)displayTimePickerViewForDayButton:(id)sender {

    NSLog(@"displayTimePickerViewForDayButton method entered.");

    // create the selector view controller and become the delegate
    WOTimePickerViewController *tpvc = [[WOTimePickerViewController alloc] initWithNibName:@"WOTimePickerView" bundle:nil];
    tpvc.delegate = self;
    tpvc.modalTransitionStyle = UIModalTransitionStyleCoverVertical;

    [self presentModalViewController:tpvc animated:YES];
    [tpvc release];
}

내 wotimepickerviewcontroller가 Init 메소드에서 성공적으로 돌아오고 있음을 확인했지만보기는 결코 ViewDidload 메소드를 입력하지 않습니다.

따라서 IB의보기를 보면 VC의 "보기"속성에 연결된 것으로 보입니다. 시뮬레이터에서보기를 실행하면 (IB에서) 올바르게 렌더링됩니다.

Xcode에서 앱을 실행하면보기로 이동하여 내 버튼을 클릭하면 빈 흰색 화면이 나타납니다 (참고로드 해야하는보기의 흰색 배경이 아닙니다).

도움이 되었습니까?

해결책

이렇게해야 해요 ..

WOTimePickerViewController *tpvc = [[WOTimePickerViewController alloc] initWithNibName:@"WOTimePickerView" bundle:nil];
    tpvc.delegate = self;
UINavigationController *navCntrlr = [[UINavigationController alloc] initWithRootViewController:tpvc];
    navCntrlr.modalTransitionStyle = UIModalTransitionStyleCoverVertical;

    [self.navigationController presentModalViewController:tpvc animated:YES];
    [tpvc release];

그러나 당신이 놓친 중요한 것은 당신이 제대로하지 않는다는 것입니다.

당신은 그것을 좋아해야합니다 :

[self.navigationController presentModalViewController:tpvc animated:YES];

그리고 Modalview 컨트롤러를 기각하려면 다음과 같이해야합니다.

[self.navigationController dismissModalViewControllerAnimated:YES];

다른 팁

View Controller의 ModalTransitionStyle이 표시된 모달 뷰에 적용된다고 생각합니다. ~에서 그보기 컨트롤러. 따라서 UimodaltransitionStylecoververtical Transition을 사용하여 모달 컨트롤러를 표시하려면 ModalTransitionStyle 속성을 새로운 뷰 컨트롤러 (SELF)에서 설정해야합니다.

ModalTransitionStyle을 사용한 경험이 없지만보기가로드되기 전에 해당 속성을 설정할 수 있습니까? 나는 그것을 언급 할 것입니다 ...

IB에서 모든 것이 올바르게 구성된 것처럼 들립니다. 파일의 소유자가 뷰 컨트롤러 인 한,보기 콘센트는보기에 묶여 있어야합니다.

도움이되기를 바랍니다.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top