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 07-31-2010, 12:17 PM   #1 (permalink)
Registered Member
 
lifeCoder45's Avatar
 
Join Date: Nov 2009
Location: Illinois
Posts: 92
lifeCoder45 is on a distinguished road
Send a message via AIM to lifeCoder45
Default Quick Keyboard Question

Hey guys, I have a UITextField, that uses UIKeyboardNumberPad. I'm using it to enter a dollar amount. So what I want is, when the user loads the view, the field has a value of 0.00. I have this done, but what I want now is, when the user pushes a number, it pushes it onto the amount, but maintains the .xx;

Like so:
Code:
Value: 0.00

Type 1

Value: 0.01

Type 5

Value: 0.15

Type 0

Value: 1.50

Type 5:

Value: 15.02

Backspace

Value: 1.50
Make sense? I'm guessing I probably need to do some string manipulation in one of the UITextField delegate methods?

Thanks!

- Josh
lifeCoder45 is offline   Reply With Quote
Old 07-31-2010, 08:44 PM   #2 (permalink)
Registered Member
 
lifeCoder45's Avatar
 
Join Date: Nov 2009
Location: Illinois
Posts: 92
lifeCoder45 is on a distinguished road
Send a message via AIM to lifeCoder45
Default

Bump
lifeCoder45 is offline   Reply With Quote
Old 08-01-2010, 11:28 AM   #3 (permalink)
Registered Member
 
lifeCoder45's Avatar
 
Join Date: Nov 2009
Location: Illinois
Posts: 92
lifeCoder45 is on a distinguished road
Send a message via AIM to lifeCoder45
Default

Ok, so I've been looking into this, and I think NSFormatter may be what I need to get the job done. I've looked through the docs, but they are a little overwhelming!

My new question is, is there a setting I can set NSFormatter to to force the input number to an X.xx decimal, BUT without the user typing the '.'? What I want is for all of the numbers to be pushed to the right.

Like so:

Code:
User types '1';

Formatter, populate UITextfield with: 0.01;

User types '2';

Formatter, populate UITextfield with: 0.12;

User types '4';

Formatter, populate UITextfield with: 4.12;

User deletes '1';

Formatter, populate UITextfield with: 0.42;
etc?

Basically I want the user to enter a dollar amount, with cents, but I only want them to have access to the 0-9 numpad.

Thanks!

- Josh

Last edited by lifeCoder45; 08-02-2010 at 08:10 AM.
lifeCoder45 is offline   Reply With Quote
Old 08-02-2010, 08:10 AM   #4 (permalink)
Registered Member
 
lifeCoder45's Avatar
 
Join Date: Nov 2009
Location: Illinois
Posts: 92
lifeCoder45 is on a distinguished road
Send a message via AIM to lifeCoder45
Default

Another bump
lifeCoder45 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: 353
9 members and 344 guests
alexP, gordo26, headkaze, mistergreen2011, nobstudio, Objective Zero, rayjeong, revg, Sloshmonster
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,655
Threads: 94,116
Posts: 402,889
Top Poster: BrianSlick (7,990)
Welcome to our newest member, pungs
Powered by vBadvanced CMPS v3.1.0

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