|[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]|
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:
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." _______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
Visit the Apple Store online or at retail locations.
Copyright © 2011 Apple Inc. All rights reserved.