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-04-2010, 09:11 AM   #1 (permalink)
Registered Member
 
Join Date: Jan 2010
Location: Johnson City TN
Posts: 6
Default Button sends text to text field

I need to create a Button that when pressed will enter a string of text into a text field - any ideas out there?
Sounder is offline   Reply With Quote
Old 02-04-2010, 10:48 AM   #2 (permalink)
Registered Member
 
DenVog's Avatar
 
Join Date: Jan 2009
Location: Silicon Valley, USA
Posts: 622
Default

Quote:
Originally Posted by Sounder View Post
I need to create a Button that when pressed will enter a string of text into a text field - any ideas out there?
I think the easiest way is to just use an IB action and tell the label to display the text. This isn't tested. Just to get you started.
Code:
// Define action (method) that will get called in response to a tap on the button 
- (IBAction) displayTextButton {
//Define text string to be disaplayed
NSString *item = @"My text to display";
// this is how we write the string to the text field
textLabel.text = [NSString stringWithFormat: @"%@", item];
}
DenVog is offline   Reply With Quote
Old 02-04-2010, 12:12 PM   #3 (permalink)
Registered Member
 
Join Date: Jan 2010
Location: Johnson City TN
Posts: 6
Default

Thank you so much - will this put the text into a pre-defined text field or will appear on the screen as an editable string?



Quote:
Originally Posted by DenVog View Post
I think the easiest way is to just use an IB action and tell the label to display the text. This isn't tested. Just to get you started.
Code:
// Define action (method) that will get called in response to a tap on the button 
- (IBAction) displayTextButton {
//Define text string to be disaplayed
NSString *item = @"My text to display";
// this is how we write the string to the text field
textLabel.text = [NSString stringWithFormat: @"%@", item];
}
Sounder is offline   Reply With Quote
Reply

Bookmarks

Tags
button, button to text field, string to field

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: 327
21 members and 306 guests
@sandris, ADY, dacapo, Dani77, djohnson, dre, HDshot, HemiMG, JasonR, MarkC, mer10, nibeck, prchn4christ, ryandb2, spiderguy84, themathminister, timle8n1, tomtom100, vogueestylee, vvenkatachallam
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,883
Threads: 89,229
Posts: 380,763
Top Poster: BrianSlick (7,129)
Welcome to our newest member, vvenkatachallam
Powered by vBadvanced CMPS v3.1.0

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