2012-12-17 2 views
-2

cell에 사용자가 클릭 한 후 내가 코드의 일부 후에이 작업을 수행 :맞춤 UITableView 클래스에서 dismissModalViewControllerAnimated?

[self.window.rootViewController presentModalViewController:mailer animated:YES]; 

을 그가 버튼을 취소하거나이 법에 보내 히트 다음 때

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 
{ 
[[((UIViewController *)(self.superview.superclass)) presentedViewController] dismissModalViewControllerAnimated:NO]; 
} 

하지만 내 응용 프로그램 충돌을 밖으로 이동합니다. 당신은 VC에서 해제하려는 경우

012-12-17 18:52:09.243 testapp[8293:15203] Mail cancelled: you cancelled the operation and no email message was queued 
2012-12-17 18:52:09.243 testapp[8293:15203] +[UIResponder presentedViewController]: unrecognized selector sent to class 0xbb5db0 
2012-12-17 18:52:09.244 testapp[8293:15203] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '+[UIResponder presentedViewController]: unrecognized selector sent to class 0xbb5db0' 
*** First throw call stack: 
(0x1ba6022 0x1688cd6 0x1ba7aad 0x1b0ced0 0x1b0ccb2 0x4e466 0xa99bf 0xac64f 0xa63f2 0x8d05af 0x1ba7e99 0x50f14e 0x50f0e6 0x5b5ade 0x5b5fa7 0x5b5266 0x5343c0 0x5345e6 0x51adc4 0x50e634 0x1d39ef5 0x1b7a195 0x1adeff2 0x1add8da 0x1adcd84 0x1adcc9b 0x1d387d8 0x1d3888a 0x50c626 0x370d 0x26c5 0x1) 
+0

오류 또는 경고? – vikingosegundo

+0

빌드가 완료되었습니다. 하지만 언제 응용 프로그램을 실행하고 충돌을 닫으 시도하십시오 – Omarj

+0

@ Mindaugas ???? – Omarj

답변

0

가 충돌하는 이유 [controller dismissModalViewControllerAnimated:NO];

+0

은 매력처럼 작동합니다. thanx thanx보다 – Omarj

+0

언제든지 환영합니다;) –

0

다음이 작동합니다 단순히 [self dismissViewControllerAnimated:NO completion:nil]

+0

당신이 내 질문을 읽는다면 당신은 이것이 나에게 오류를 줄 것이라는 것을 알 것이다. – Omarj

+0

그래서 그것은 내게 줄 것이다 (사용자 정의 테이블 뷰 클래스는 'CustomTableView'에 대한 @interface가 선택자 'dismissViewControllerAnimated'를 선언하지 않음 : – Omarj

+0

) [[((UIViewController *) (self.superview.superclass))) rendered viewController] dismissModalViewControllerAnimated : NO];'예외 브레이크 포인트 활성화 시도. 충돌시 어떻게됩니까? – Levi

0

보십시오 :

- (void)mailComposeController:(MFMailComposeViewController*)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError*)error 
{ 
    [self dismissModalViewControllerAnimated:NO]; 
} 
+0

에 캐스트를 만들 수 없습니다. 내 질문을 읽으면 오류가 발생합니다. – Omarj

+0

오류/예외를 게시하십시오. 응용 프로그램이 충돌 할 때 로그에 인쇄됩니다. –

+0

그것은 사용자 정의 tableview 클래스이므로 나에게 줄 것이다. 'CustomTableView'선택기 'dismissViewControllerAnimated 선언 :' – Omarj

0

시도는 presentedViewController 아니라 iOS 5 이상에 존재합니다. iOS 4에서 실행하면 예외가 표시됩니다.

dismissModalViewController는 iOS 4 + 5 용 presentModalViewController로 제공되는 컨트롤러를 제거하는 올바른 방법입니다. iOS 6에서도 여전히 작동하지만 더 이상 사용되지 않습니다. 이제는 ViewController를 표시하고 대신 ViewController를 dismiss하십시오.

관련 문제