2014-05-13 4 views
0

xib 파일로 양식을 디자인했습니다. 양식에 button "완료"가 있습니다. 클릭이 완료되면 button을 입력하면 my view controller으로 전달됩니다. "presentModelViewController"에서양식을보기 컨트롤러에 전달

UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main.storyboard" bundle:nil]; 
CommentViewController *myVC = (CommentViewController *)[storyboard instantiateViewControllerWithIdentifier:@"Comment"]; 
[self presentModalViewController:myVC animated:YES]; 

그러나 오류 :

는이 같은 코드를 시도했다.

" No visible @interface for 'my form' declares the selector 'presentModalViewController'... 
+0

오류는 _what_입니다. – matt

+0

오류는 "보이지 않는 @ '내 양식'의 인터페이스가 셀렉터 'presentModalViewController'를 선언합니다 ... –

+0

그래서 'self'는 UIViewController가 아니므로'presentModalViewController'를'self'로 보낼 수 없습니다. 보기 컨트롤러에 보냅니다! – matt

답변

0

문제는 selfUIViewController되지 않는 것입니다. 따라서 presentModalViewController을 자기에게 보낼 수 없습니다. 보기 컨트롤러로 보내십시오! self이 UINavigationController가 있습니다

1

경우, 이것을 사용 : self가있는 UIViewController입니다

[self.navigationController pushViewController:yourViewController animated:YES]; 

경우, 이것을 사용 : presentModalViewController: animated: 이제 사용되지 않습니다 : 것을

[self presentModalViewController:yourViewController animated:YES]; 

참고.

+0

폼에서 호출합니다. 내보기 내 양식 팝업. –

0
UIStoryboard *loStoryboard ; 
loStoryboard = [UIStoryboard storyboardWithName:@"Main" bundle:nil]; // Here only "Main" not "Main.storyboard". 

// Instantiate the initial view controller object from the storyboard 
UIViewController *initialViewController = [loStoryboard instantiateInitialViewController]; 

// Instantiate a UIWindow object and initialize it with the screen size of the iOS device 
self.view = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; 

// Set the initial view controller to be the root view controller of the window object 
[self.navigationController pushViewController:initialViewController animated:YES]; 
+0

답장을 보내 주셔서 감사합니다.하지만 3 번 줄에서 물어보고 싶습니다. 내 양식에는보기가없고, 양식은 텍스트 필드와 단추가있는 양식이며,보기 컨트롤러에서 팝업이라고합니다. !! –

+0

당신은 NSUSERDEFAULT 또는 initialViewController.text = textfield.text를 사용하여 TextContent & Button과 같은 모든 항목을 ViewController에 보내야합니다. –

관련 문제