开发者

how can i use mailComposer in iPad as well as iPhone?

I have implemented mail Composer for iPhone and it's working Fine i want to use that mail composer in iPad also so wha开发者_开发知识库t should i change or please Guide me how can i implement Mail composer in iPad?if possible then please give me a sample code also for that.Thanks in Advance..


HI!I have implemented this code and you can implement it by just writing below code:

MFMailComposeViewController *mailController = [[MFMailComposeViewController alloc] init];

mailController.mailComposeDelegate = self;

mailController.modalPresentationStyle = UIModalPresentationFullScreen;
[mailController setSubject:@"Hello iPhone"];
[mailController setMessageBody:@"Please Find The Attachment...." isHTML:NO];
mydata = [[NSData alloc] initWithContentsOfURL:[NSURL URLWithString:[ImgUrl objectAtIndex:offsetX]]];

UIImage *pic = [[UIImage alloc] initWithData:mydata];

NSData *exportData = UIImageJPEGRepresentation(pic ,1.0);
[mailController addAttachmentData:exportData mimeType:@"image/jpeg" fileName:@"Picture.jpeg"];

[self presentModalViewController:mailController animated:NO];
[mailController release];


It works fine only if the Mail setup is configured in your Device, otherwise it crashes..! So First setup the Mail Configuration and use this code to work. (Settings >> Mail, Contacts, Calander >> AddContact) it works for both iPhone and iPad as well -- Ranganatha G V

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜