| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
size.height is a float, not an int, so use:
NSLog(@"%f", size.height);
Patrick
On Jul 27, 2006, at 9:52, Alan Smith wrote:
Shoot!!! I didn't mean to send it twice. GMail wasn't responding so I didn't think it had been sent already.
I'm really really sorry.
On 7/27/06, Alan Smith <email@hidden> wrote:Hello everyone,
I have code like this in an NSView subclass:
NSSize size = [self bounds].size; NSLog(@"%i", size.height); size.height = [pattern size].height; NSLog(@"%i", size.height); [self setBoundsSize: size];
'pattern' is an NSImage, width = 1px height = 16px. I drew it in PS so I now the dimensions. With the above code I want to shrink the view down to the height of the image but, not the width. This image will change so I don't want to hard code 16 in there.
When I run this code I get huge numbers in the output:
1079033856 the first time and, 1077542912 the second time.
Obviously there is something very wrong.
I ran it again but changed one of the NSLogs. This time I wanted the height of just the image, it printed:
1077542912
This I don't understand. The image is not that tall.
Let me explain what I am trying to create and perhaps you have a better way to do it.
I'm making a bar that will be filled with a pattern image. I want it the height of the image but, since this will be a pattern, I don't want it 1px wide. And… that is pretty much it. Nothing else will be done to this view except it will draw several buttons on top of this patterned background.
Thanks for all help, Alan
-- // Quotes from yours truly ------------------------- "You don't forget, you just don't remember." "Maturity resides in the mind." "Silence is the Universe's greatest gift." "Don't waste your life doing things others have already done."
-- // Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"Don't waste your life doing things others have already done."
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/ email@hidden
This email sent to email@hidden
_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/email@hidden
| References: | |
| >How do I size a NSView to fit an NSImage? (From: "Alan Smith" <email@hidden>) | |
| >Re: How do I size a NSView to fit an NSImage? (From: "Alan Smith" <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.