Re: [NEWB] An object, an array item and a string
Re: [NEWB] An object, an array item and a string
- Subject: Re: [NEWB] An object, an array item and a string
- From: Nathan Kinsinger <email@hidden>
- Date: Sat, 6 Sep 2008 21:24:43 -0600
On Sep 6, 2008, at 7:10 PM, Aron Spesard wrote:
So after reading the various image viewer tutorials on the web and
getting through the StretchView chapter in Cocoa Programming for MAC
OS X, I decided to try and write one that takes a couple of arrays
of images and composites two images together. Click a button and the
view updates to the next composite image.
I was able to get the items in the arrays from open sheets and that
all made sense. Before I even tried to start drawing things in Rect
I tried to just put the path in a text box with the click of a
button. I thought the below was the way to go:
- (IBAction)viewClientFiles:(id)sender
{
NSString *imagePath = (clientFileName);
[textField setStringValue:imagePath];
NSLog(@"current client file name:%a",imageName);
}
which compiles but hangs the app
The thing I don't really understand is that when I log
clientFileName in openPanelDidEnd action
the log is the path to the file, but in the above action it's
"0x1.838000f085p-1029"
Why is that and how can I get that item's path?
thanks,
Aaron
The problem is the %a in the NSLog string. %a is a floating point
number in hex format. In this case it's converting the address of the
pointer imageName to a hex floating point number.
The correct conversion character for NSStrings (or most any Objective-
C object) is %@.
--Nathan
_______________________________________________
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