IKImageBrowser Non-Square Cells
IKImageBrowser Non-Square Cells
- Subject: IKImageBrowser Non-Square Cells
- From: Trygve Inda <email@hidden>
- Date: Sun, 18 May 2014 15:56:33 -0700
- Thread-topic: IKImageBrowser Non-Square Cells
Using apple sample ImageBrowserAppearance code as a basis, I am trying to
make non-square cells in an IKImageBrowser.
Specifically my cells need to be an aspect ration of 2:1 (wide) instead of
square.
I have overridden:
-(NSRect)imageContainerFrame
-(NSRect)selectionFrame
-(NSRect)frame
In
-(CALayer *)layerForType:(NSString*) type
I have to use
NSRect backgroundRect = NSMakeRect(0, x, frame.size.width,
frame.size.height);
Where x is NOT zero, but is moved up by the amount that the vertical
dimension of the cell has shrunk. If my cell is 100x50, then x must be 50.
This works, except the vertical spacing between rows is too high as it is
assuming square cells.
I had to correct it with:
[myBrowser setIntercellSpacing:NSMakeSize(10, -40)];
To get a real 10,10 spacing (10 - 50 = -40) using the size above.
This seems all wonky.
Does anyone have a sample of non-square cells in IKImageBrowser?
Thanks,
Trygve
_______________________________________________
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