open iphone Mail from Actionsheet..

Posted by totato on Stack Overflow See other posts from Stack Overflow or by totato
Published on 2010-04-25T18:53:08Z Indexed on 2010/04/25 18:53 UTC
Read the original article Hit count: 264

Filed under:

hi ..

I want to open Mail app from my app when the one button in actionsheet is pressed, I know this way :

-(IBAtion)openClick:(id)sender

{ [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”mailto:[email protected]”]]; }

but can I write this method inside if statement or switch case?(in ControlView class NOT NSObject class , because I use actionsheet for this propose)

like this:

     - (void)actionSheet:(UIActionSheet *)modalView clickedButtonAtIndex:(NSInteger)buttonIndex

{

switch (buttonIndex)
{
    case 0:
    {

[[UIApplication sharedApplication] openURL:[NSURL URLWithString:@”mailto:[email protected]”]]; break; }

I can't test my code because simulator doesn't have the Mail app.. So I need to know is this will work in controlView or must write it in NSObject class ?

+ seconde question : I want to open Mail app from my app and copy the content in the view to mail body,then the user choice the contact from his contacts list ! Is this way achieve my goal?

© Stack Overflow or respective owner

Related posts about c#