Hi,

I can't quite get my head around obj-c sometimes, so i was just wondering if anyone could point me in the right direction.

I've got a fairly simple coredata app that I code and use to keep track of some work stuff (I run my own business), and it automatically generates composite images for me. At the moment it's set to re-size the original images and fit them into a 3x4 grid, but if theres only a few images it looks very odd, so I want to change it so if there are less than 8 images it lays them out differently. In non code what I want to do is:


for NSMakeRect(0,0,x,y)

origin to stay at 0,0
calculate scale factor (sf) by dividing 225(required height) by the original height: sf = 225 / originalheight

x = requiredwidth / sf

y = originalheight

I can't work out how to get the original height and width of the image, and I think i'm getting confused with number formats, I've got the following at the moment but my width variable is coming out as null?

NSArray* kitImages = [kit valueForKeyPath:@"kitItems.kitItemProduct.productImage"];
        int ki = [kitImages count];
        NSLog(@"Number of images: %i",ki);
        //calc image width
        float width = 300 / ki;
        NSLog(@"Width: %@",width);

I'd appreciate any help.

Many Thanks

Amy
_______________________________________________

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 arch...@mail-archive.com

Reply via email to