我有我的MFMessageComposeViewController麻煩。我想使用SMS in-app。 一切工作正常發送短信,迄今爲止很好。但是,當我點擊取消按鈕(或發送按鈕)我的觀點頂部消失,但鍵盤沒有。這可能是因爲我不使用modale視圖,而只是一個addSubview。MFMessageComposeViewController關閉鍵盤
-(void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result
{
if (result == MessageComposeResultCancelled)
{
NSLog(@"Message annulé");
[controller resignFirstResponder];
[controller.view removeFromSuperview];
[controller release];
}
else if (result == MessageComposeResultSent)
{
NSLog(@"Message envoyé");
...
}
else
{
NSLog(@"Message non envoyé");
...
}
}
-(void)sendSMS:(NSString *)bodyOfMessage :(Phone *)recipient
{
MFMessageComposeViewController *controller = [[MFMessageComposeViewController alloc] init];
if([MFMessageComposeViewController canSendText])
{
MFMessageComposeViewController *picker = [[MFMessageComposeViewController alloc] init];
picker.messageComposeDelegate = self;
NSMutableArray *toRecipients = [[NSMutableArray alloc]init];
[toRecipients addObject:recipients.phoneNumber];
[picker setRecipients:(NSArray *)toRecipients];
[toRecipients release];
NSString *bodyString = nil;
bodyString = bodyOfMessage;
[picker setBody:bodyString];
[self addSubView:picker.view];
[picker release];
}
}
任何想法?我只使用modalView?
遺憾的拼寫錯誤...
謝謝。 Tommy
好的謝謝;) – 2012-02-10 10:52:40