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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.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 10-23-2010, 10:52 PM   #1 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 32
y2kreddy is on a distinguished road
Default Capturing a UIText value

Hello developers

i know how to capture a text value in a string,which obviously most of us knows . that is not what i want.

i am trying to capture any key pressed in a UIText field as and when it is typed and append the captured key value to a string. how can i do this?
i know its just custom method with less than 4 lines of code after using the "Editing changed" event. but i am not able to get there.

REMEMNER!!!!. i need to capture only the key that was pressed and not the whole string in the uitext field as and when it is typed.

Any Hint or code would be greatly appreciated.

Thank You.
Good Luck.
y2kreddy is offline   Reply With Quote
Old 10-24-2010, 02:15 AM   #2 (permalink)
Registered Member
 
Join Date: Jul 2010
Posts: 327
thomashw is on a distinguished road
Default

You could override the
Code:
- (BOOL)textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string
method, and then use the
Code:
- (unichar)characterAtIndex:(NSUInteger)index
method on string to get the character.
thomashw is offline   Reply With Quote
Old 10-26-2010, 04:39 AM   #3 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 32
y2kreddy is on a distinguished road
Default

Hey there

can you tell me how to do i append a string value to a UItext field.

for example :
if UItext already has value ABCDEF, and i have a string with value say, "lmonp". how do i append this string to UITEXT field value.

not all methods of nsstring can be used for uitext field. i am not able to use the stringbyappeningsting method for a uitext object, because it only responds to nsstring objects. is there any way around.

thanks.
y2kreddy is offline   Reply With Quote
Old 10-26-2010, 08:35 AM   #4 (permalink)
Nuisance Developer
 
Join Date: Jul 2009
Location: Italy
Posts: 4,691
dany_dev is on a distinguished road
Default

Quote:
Originally Posted by y2kreddy View Post
Hey there

can you tell me how to do i append a string value to a UItext field.

for example :
if UItext already has value ABCDEF, and i have a string with value say, "lmonp". how do i append this string to UITEXT field value.

not all methods of nsstring can be used for uitext field. i am not able to use the stringbyappeningsting method for a uitext object, because it only responds to nsstring objects. is there any way around.

thanks.
mmm...google?.
However stringByAppendingString return a NSString.

Code:
NSString *string1 = @"Hello";
NSString *string2 = @"World!";
 
NSString *stringHW = [string1 stringByAppendingString @" "];
NSString *stringHW = [stringHW stringByAppendingString string2];

yourTextField.text = stringHW;

OR

Code:
NSString *stringHW = [NSString stringWithFormat:@"%@ %@", string1, string2];

yourTextField.text = stringHW ;
__________________
dany_dev 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: 323
12 members and 311 guests
chiataytuday, condor304, Desert Diva, Domele, dre, dreamdash3, mottdog, oceanlablight, palme2elie, Paul Slocum, schmallegory
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,659
Threads: 94,118
Posts: 402,895
Top Poster: BrianSlick (7,990)
Welcome to our newest member, dreamdash3
Powered by vBadvanced CMPS v3.1.0

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