 |
 |
|
 |
02-22-2009, 08:12 AM
|
#1 (permalink)
|
|
New Member
Join Date: Jan 2009
Posts: 9
|
Help with e-mailing displayLabel text
My app is a single window app currently with a text label and a button. When you press the button the text label updates with random text from a local database. I'd like to add the functionality to e-mail the current display text with a separate e-mail button down below. I am posting the current button functionality and was looking for some assistance to see if it is possible to capture the current displayLabel text with a new button.
Current code:
Code:
/*!
@function tapButtonPressed
@discussion This function is called when "Tap Me Now" button is pressed
@param sender
@result displays the random text from the database in Label
*/
-(IBAction)tapButtonPressed:(id)sender
{
ShakeMeAppDelegate *appDelegate = (ShakeMeAppDelegate *)[[UIApplication sharedApplication] delegate];
NSInteger randomNumber = [self getRandomIndex];
//NSLog(@"Selected shake text is %@", [[appDelegate.shakeTexts objectAtIndex:randomNumber] text]);
displayLabel.text = [[appDelegate.shakeTexts objectAtIndex:randomNumber] text];
}
|
|
|
02-22-2009, 10:41 AM
|
#2 (permalink)
|
|
Registered Member
Join Date: Dec 2008
Posts: 428
|
you do realise that you need to somehow capture the mail recipient address, right?
generally you can use the "mailto:" URL scheme to send mails (and include your text in the body of the message). Be aware that this will close your program and open mobile mail.
|
|
|
02-22-2009, 11:39 PM
|
#3 (permalink)
|
|
New Member
Join Date: Jan 2009
Posts: 9
|
Can I just pass the subject and body text and have the user enter the To: address once they are passed to the mail app, or does the url just call the mail app and everything has to be pre-entered?
|
|
|
02-22-2009, 11:48 PM
|
#4 (permalink)
|
|
New Member
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,121
|
Just call openURL with:
@"mailto:?subject=<escaped subject>&body=<escaped body text>"
This will launch mobile mail with the subject and body prepopulated. The user must then pick one or more email addresses and tap the Send button.
|
|
|
02-23-2009, 07:57 AM
|
#5 (permalink)
|
|
New Member
Join Date: Jan 2009
Posts: 9
|
Quote:
Originally Posted by RickMaddy
Just call openURL with:
@"mailto:?subject=<escaped subject>&body=<escaped body text>"
This will launch mobile mail with the subject and body prepopulated. The user must then pick one or more email addresses and tap the Send button.
|
That would work just fine to start until I can mess around with the other sdk which will allow you to send e-mails from within the application. Does anyone have any suggestion on how I can get the displayLabel.text value into the body string of the e-mail url? I'm sorry if this is really simple, but this is my first app and everything is still very confusing to me lol.
|
|
|
02-24-2009, 08:56 AM
|
#6 (permalink)
|
|
New Member
Join Date: Jan 2009
Posts: 9
|
Quote:
Originally Posted by aschaef
My app is a single window app currently with a text label and a button. When you press the button the text label updates with random text from a local database. I'd like to add the functionality to e-mail the current display text with a separate e-mail button down below. I am posting the current button functionality and was looking for some ***istance to see if it is possible to capture the current displayLabel text with a new button.
Current code:
Code:
/*!
@function tapButtonPressed
@discussion This function is called when "Tap Me Now" button is pressed
@param sender
@result displays the random text from the database in Label
*/
-(IBAction)tapButtonPressed:(id)sender
{
ShakeMeAppDelegate *appDelegate = (ShakeMeAppDelegate *)[[UIApplication sharedApplication] delegate];
NSInteger randomNumber = [self getRandomIndex];
//NSLog(@"Selected shake text is %@", [[appDelegate.shakeTexts objectAtIndex:randomNumber] text]);
displayLabel.text = [[appDelegate.shakeTexts objectAtIndex:randomNumber] text];
}
|
Does the email function need to go within the button tap function, or can i just reference the displayLabel.text in a separate button press function?
|
|
|
 |
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
» Advertisements |
» Online Users: 226 |
| 16 members and 210 guests |
| benoitr007, Breshi, codezy, dbonneville, irishkiwi, Jompe71, leeks, mizyeh, myPhone, n8r0n, Oliver Drobnik, pkouame, prathumca, Rashomon, smilespray, their |
| Most users ever online was 779, 05-11-2009 at 09:55 AM. |
» Stats |
Members: 24,279
Threads: 39,072
Posts: 171,328
Top Poster: smasher (2,575)
|
| Welcome to our newest member, yogen81 |
|