Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 02-22-2009, 09:12 AM   #1 (permalink)
New Member
 
Join Date: Jan 2009
Posts: 9
Default 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];
	
}
aschaef is offline   Reply With Quote
Old 02-22-2009, 11:41 AM   #2 (permalink)
Registered Member
 
Join Date: Dec 2008
Posts: 429
Default

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.
lbendlin is offline   Reply With Quote
Old 02-23-2009, 12:39 AM   #3 (permalink)
New Member
 
Join Date: Jan 2009
Posts: 9
Default

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?
aschaef is offline   Reply With Quote
Old 02-23-2009, 12:48 AM   #4 (permalink)
Registered Member
 
RickMaddy's Avatar
 
Join Date: Oct 2008
Location: Denver, CO
Posts: 2,122
Default

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.
RickMaddy is offline   Reply With Quote
Old 02-23-2009, 08:57 AM   #5 (permalink)
New Member
 
Join Date: Jan 2009
Posts: 9
Default

Quote:
Originally Posted by RickMaddy View Post
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.
aschaef is offline   Reply With Quote
Old 02-24-2009, 09:56 AM   #6 (permalink)
New Member
 
Join Date: Jan 2009
Posts: 9
Default

Quote:
Originally Posted by aschaef View Post
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?
aschaef is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 903
23 members and 880 guests
2e1fmo, at0m87, aziz, Azuresilver, coding, Desert Diva, el.severo, fiftysixty, imran_ime4u, iVenh, jjaaxx44, nicko, Pasha2590, pratikchandak, Promo Dispenser, ramonpadillas, RoryHarvey, Thomas, ziocleto, zowan, Zuningo
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,312
Threads: 89,035
Posts: 379,823
Top Poster: BrianSlick (7,086)
Welcome to our newest member, 2e1fmo
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 05:34 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0