Math issue dividing view in subviews

21 Views Asked by At

I have a math question in order to make some objective-c code for my app.

I have n images with fixed dimensions. I would like to divide these images over a view in rows and columns. The view has dimensions x / y. I want the images to have the maximum size (surface) although their dimensions are fixed.

I think this is a math problem I probably learned in school but I forgot.

I contemplated writing a bit of trial and error code but there must be a more elegant solution.

If the surface is square the solution is simply the square root. But this is not always the case.

Cheers Nick

0

There are 0 best solutions below