-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 6/10/11 7:56 PM, William Squires wrote:
> Hi! 1st question: In regular C, you have the <stdio.h> functions for
> reading/writing to stdio; printf(), scanf(), etc... In C++, you have
> cin/cout and the overridden '>>' and '<<' operators. What does ObjC
> have (besides NSLog() anyway) that C/C++ doesn't? I'm guessing...
> zilch. You have to use the standard C libraries, right? Or is there
> an OO way of reading/writing to stdio (and stderr) from a console
> app? Or use ObjC++...

In addition to what others have said, if you mean to spawn and
communicate with another process instead of just abstractly talking
about stdio, take note of NSTask and, in particular, its setStandard...
methods.  (It, in turn, can employ either an NSFileHandle or an NSPipe.)

> 4th question: Are there any plans to include NumberFormatter and
> DateFormatter in iOS 5 (or later)? If not, what's the recommended way
> of filtering/displaying/validating input in a UITextField that I want
> to only have valid floating-point values when I go to do calculations
> on them.

Umm, NSNumberFormatter and NSDateFormatter have been available since the
SDK was first available:


http://developer.apple.com/library/ios/#DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSDateFormatter_Class/Reference/Reference.html

http://developer.apple.com/library/ios/#DOCUMENTATION/Cocoa/Reference/Foundation/Classes/NSNumberFormatter_Class/Reference/Reference.html


However, there is no analog (AFAIK) to NSControl's formatter/setFormatter.

However, for the case of, e.g., validation you could implement in the
text field's delegate:

- - (BOOL)textField:(UITextField *)textField
shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString
*)string

use whatever NSNumberFormatter techniques suit you, and return NO if
invalid.  In this case, validation would be run during typing.  If you
wanted to defer validation until after entry is complete, instead
implement:

- - (BOOL)textFieldShouldEndEditing:(UITextField *)textField

(Also, I should note that you can probably prevent most issues by just
using the numeric keyboard type for the field.)

- -- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFN8uCvaOlrz5+0JdURAqs/AJ46hdgc4bpFENROmSHnFR9HH3EgpgCeLPlx
AUkqpL9Y572SElRpbm86ebM=
=9LE2
-----END PGP SIGNATURE-----
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to