2011-10-11 2 views
0

내 응용 프로그램이 가로 모드입니다. 전자 메일 시트를 열면 세로 방향으로 - 이고 확인 메시지는입니다. 키보드가 가로로 열리므로 세로 전자 메일 시트와 가로형 키보드가 있습니다.이메일 키보드가 가로 방향입니까?

키보드를 세로로 삽입하면 어떻게 고칠 수 있습니까? 왜 "취소"를 누르면 앱으로 돌아 가지 않고 아무 일도 일어나지 않습니까?

//send email log------------------------- 
     NSLog(@"mail"); 
     [[CCDirector sharedDirector] pause]; 

     picker = [[MFMailComposeViewController alloc] init]; 
     picker.mailComposeDelegate = self; 

     //Fill in the email as you see fit 
     NSArray *toRecipients = [NSArray arrayWithObject:@"[email protected]"]; 
     [picker setToRecipients:toRecipients]; 


     NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); 
     NSString *dataPath = [[paths objectAtIndex:0] stringByAppendingPathComponent:@"BetaTest.txt"]; 
     NSData *data = [NSData dataWithContentsOfFile:dataPath]; 
     [picker addAttachmentData:data mimeType:@"text/txt" fileName:@"BetaTest.txt"]; 

     NSString *emailBody = @"test :) "; 
     [picker setMessageBody:emailBody isHTML:NO]; 
     [picker setSubject:@"hardware test##"]; 

     //display the view 
     [[[CCDirector sharedDirector] openGLView] addSubview:picker.view]; 
     [[CCDirector sharedDirector] stopAnimation];  

답변

1

하는 대신 현재 활성화 된보기로 MFMailComposeViewController 인스턴스의보기를 추가, 당신은 모달 뷰 컨트롤러로 표시해야합니다. 불행히도 cocos2d (코드에서 가지고있는 CCDirector 클래스에서 사용한다고 가정)는 기본 UIKit 디스플레이 위에 빌드되지 않습니다.

이것은 응용 프로그램의 루트보기 컨트롤러를 찾아서 presentModalViewController: 메서드를 호출해야한다는 것을 의미합니다. 이를 수행하는 방법에는 여러 가지가 있습니다. 예를 들어이 블로그 게시물 (다른 사람이 작성했지만 괜찮은 접근법)에 설명 된 방법과 같습니다. http://indiedevstories.com/2011/06/25/modal-view-controllers-in-cocos2d/

관련 문제