Thanks Bill and Graham.

D'oh! I've got dozens of stringWithFormat calls in my main app and this never occurred to me. I was thinking that somehow an NSTextField would take a number and convert it itself.

This will let me merge all three components of the time into one string with separator colons and the whole shebang.

I was looking to use NSDate to get an "hh:mm:ss" result that allowed hours > 24, but I do not think that is possible, so I went the NSCalendarDate route. I remember having the same problem in AppleScript with the time portion of a date.

Thanks a bunch for taking time to clue me in.

Johnny
On May 13, 2008, at 7:27 AM, [EMAIL PROTECTED] wrote:

From: Bill Cheeseman <[EMAIL PROTECTED]>
Subject: Re: "Controller Cannot Be nil" on binding NSTextField
To: Cocoa-Dev Mail <cocoa-dev@lists.apple.com>
Message-ID: <[EMAIL PROTECTED]>
Content-Type: text/plain;       charset="US-ASCII"

on 2008-05-13 12:06 AM, Johnny Lundy at [EMAIL PROTECTED] wrote:

I still have to do the crazy

self.hoursString = [[NSNumber numberWithInt: self.hours] stringValue];

To get a string from an int for the textField to bind to. If I bind it
to the model deadline.hours, which is a scalar int, it displays zero
while NSLog is merrily displaying 23 from the same variable.

Is converting the int to a NSNumber and then to a string make sense
here? Seems roundabout.

Look at the reference documentation for +[NSString stringWithFormat:], and the String Programming Guide for Cocoa (particularly the Formatting String
Objects and String Format Specifiers sections).

--

Bill Cheeseman - [EMAIL PROTECTED]
Quechee Software, Quechee, Vermont, USA
www.quecheesoftware.com

PreFab Software - www.prefabsoftware.com

_______________________________________________

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 [EMAIL PROTECTED]

Reply via email to