2013-10-04 8 views
5

현재 버튼을 탭하면 UIModalPresentationSheet가 표시됩니다. 이 슬라이드가 위로 올라갈 때 탐색 막대를 맨 위에 추가하고 싶습니다. 나는 많은 것을 시도했지만 아무것도 작동하지 않는 것 같습니다. 여기에 내가 현재 노력하고 있어이 오류를 반환합니다.모달 뷰의 내비게이션 컨트롤러

AthleteAdd *addAthlete = [self.storyboard instantiateViewControllerWithIdentifier:@"addAthlete"]; 
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:addAthlete]; 
    //[self.navigationController pushViewController:addAthlete animated:YES]; 

    addAthlete.delegate = self; 
    addAthlete.modalPresentationStyle = UIModalPresentationFormSheet; 
    // UINavigationController *navController = [[UINavigationController alloc] initWithRootViewController:addAthlete]; 
    [self presentViewController:navigationController animated:YES completion:nil]; 

그러나 modalpresentationsheet 양식없이 모달 적으로이를 밀어냅니다. 내비게이션 컨트롤러의 크기를 올바르게 조정하려면 어떻게해야합니까?

답변

12

시도는 다음과 같이 코드를 변경합니다 :

AthleteAdd *addAthlete = [self.storyboard instantiateViewControllerWithIdentifier:@"addAthlete"]; 
    UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:addAthlete]; 

    addAthlete.delegate = self; 
    navigationController.modalPresentationStyle = UIModalPresentationFormSheet; 


    [self presentViewController:navigationController animated:YES completion:nil]; 

여기에 있기 때문에, 당신은 자체에서 addAthlete을 제시하려고합니다. 그래서이 오류가 발생합니다.

+0

이 작동하지 않습니다,하지만 더 이상 modalsheetpresentation입니다 .. –

+0

내 편집을 보라) –

4

addAthlete를 넣은 navigationController를 표시해야합니다.

[self presentViewController:navigationController animated:YES completion:nil]; 
0

현재 viewcontroller 자체에서 발표하고 있습니다.

같은 것을 시도

[self dismissViewControllerAnimated:YES completion:^{ 
    [self.parentViewController presentViewController: navigationController animated:YES completion:nil]; 
}];