문제

사용자가 메인 뷰 컨트롤러의 버튼을 누르면 프로그래밍 방식으로 모달 뷰 컨트롤러를 보여줍니다.문제가있는 문제는 탐색 막대없이 모달보기가 표시된다는 것입니다.

어떻게 막대를 나타낼 수 있습니까?내 코드를 찾아 누락되었거나 잘못되었는지 알려주십시오.

-(void)appInfoButtonPressed:(id)sender {
infoViewController *iVC=[[infoViewController alloc] init];
self.modalPresentationStyle = UIModalPresentationCurrentContext;
[self presentViewController:iVC animated:YES completion:nil];
UINavigationController *navBar = [[UINavigationController alloc] initWithRootViewController:iVC];
[self presentViewController:navBar animated:YES completion:nil];
.

}

또한 모달보기를 해산하는 시도에서 아래 줄을 사용하려는 의도를 가지고 있습니다 :

[self dismissViewControllerAnimated:YES completion:nil];
.

메인 뷰 컨트롤러의 방법이나 모달 뷰 컨트롤러 자체의 방법 에이 라인을 포함시켜야합니까?

도움이 되었습니까?

해결책

삭제 [자체 PresentViewController : IVC 애니메이션 : 예 완료 : nil]; UINAvigationController를 제시 할 수 있습니다.

방법 : "navbar"가있는 UINAvigationController의 이름을 지정하는 것이 적합하지 않습니다.

-(void)appInfoButtonPressed:(id)sender {
    infoViewController *iVC=[[infoViewController alloc] init];
    self.modalPresentationStyle = UIModalPresentationCurrentContext;
    UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:iVC];
    [self presentViewController:navController animated:YES completion:nil];
}
.

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