2

내 iPad 응용 프로그램의 가운데에 모달보기 컨트롤러를 열려고합니다.iPad 중앙의 내비게이션 컨트롤러가있는 모달보기 열기

이것은 내가 내 코드

Settings_iPad *vController = [[Settings_iPad alloc] 
              initWithNibName:@"Settings_iPad" bundle:nil]; 

    vController.modalPresentationStyle = UIModalPresentationFormSheet; 

    // Create a Navigation controller 
    UINavigationController *navController = [[UINavigationController alloc] 
              initWithRootViewController:vController]; 

    // show the navigation controller modally 
    [self presentModalViewController:navController animated:YES]; 

    // Clean up resources 
    [navController release]; 
    [vController release]; 

이에서 무엇을하고 무엇을 내가 윈도우의 중앙에 작은 크기로 잘이 창을 열 수 있습니다 어떻게 http://www.use.com/48bcd41a28a13b562140

을 얻고 것입니다.

감사

답변

3

UIModalPresentationFormSheet을하고 모달을 제시 탐색 제어기에 설정 modalPresentationStyle.

navigationController.modalPresentationStyle = UIModalPresentationFormSheet; 
[self presentModalViewController:navigationController animated:YES]; 
0

당신은 다음과 같이 수행 할 수 있습니다 뷰 컨트롤러의 모달을 제시 한 후, 원하는 크기로 크기를 설정 한 다음이를 중심.

....

navController.modalPresentationStyle = UIModalPresentationFormSheet; 
[self presentModalViewController:navController animated:YES]; 
//these two lines are if you want to make your view smaller than the standard modal view controller size 
navController.view.superview.frame = CGRectMake(0, 0, 200, 200); 
navController.view.superview.center = self.view.center; 
+0

확실하지 않을지 모르지만 ... 작동하지 않는 것 같습니까? – topwik

+0

예. 나는 이것을 내 프로젝트 중 하나에서 사용했다. – aslisabanci

3

다음은 최신 iOS 7 지원 솔루션입니다.

navController.modalPresentationStyle = UIModalPresentationStylePageSheet; // can be form sheet also 
navController.modalTransitionStyle = UIModalTransitionStyleCrossDisolve;// in IOS 7 no other style let you resize your view controller's frame. 
/* important step*/ 
self presentViewController:navController animated:YES completion:^{//any code you want};];// from iOS 6 onward this is supported 
// now set size of the viewcontroller, if you will set before presenting it will simply ignore. 
navController.view.superView.frame = CGRectMake(x,y,width,height); 
navController.view.superView.center = CGPointMake (x, y); 

희망이 도움이 될 것입니다.

관련 문제