Email Data

Discussion in 'iOS Programming' started by MiniMacLean, Nov 6, 2008.

  1. macrumors newbie

    Mar 9, 2008
    I have an application,
    It auto rotates,
    It has a UITextView,
    It has a UINavigationBar,
    It has a UIBarButtonItem,

    The UIBarButtonItem is linked to a function which is:
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"[B][COLOR="Red"]Text[/COLOR][/B]"]];
    However I want the body of the email to be the contents on the UITextView but dont have a clue how to do this,

    can i do it with the same function as this now or do i have to use a different function?


    also i would like to know how to make the UINavigationBar thin when the application is auto rotated
  2. macrumors 6502a

    Oct 24, 2008
    You can access the content of a UITextView via its text property (docs: i.e.:

    NSString *body = textView.text;
    Before you can put it in a mailto to link, you need to escape it, i.e.:

    body = [body stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]
    And then you can simply construct the mailto link and insert it into the line of code you provided:

    NSString *mailto = [NSString stringWithFormat:@"", body];
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:mailto]];
  3. thread starter macrumors newbie

    Mar 9, 2008
    thanks alot works great!! :)

    anyone know how to make the navigation bar thin?

Share This Page