Re: customize the nstextfield format
Re: customize the nstextfield format
- Subject: Re: customize the nstextfield format
- From: "Alan Smith" <email@hidden>
- Date: Sat, 25 Aug 2007 13:13:18 -0400
Hello Jim,
NSControl has a setFormatter: method, you are supposed to pass in a
NSFormatter(sub)class. There are a couple formatters that Apple
supplies, NSDateFormatter and NSNumberFormatter, the latter might work
for you.
Once you have the string entered into the text field in the desired
format you can use the - [NSString componentsSeparatedByString:]
method. For example:
// Get formatted string
NSString *ipAddress = [ipAddressField stringValue];
// Split it into pieces
NSArray *ipSections = [ipAddress componentsSeparatedByString: @"."];
// Do what you want with the pieces
Hope that helps.
Peace, Alan
--
My blog: cocoalatte.info
// Things I've said -------------------------
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"When the World realizes that personal beliefs are not something to
argue or fight over, it shall evolve."
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden