-
Notifications
You must be signed in to change notification settings - Fork 113
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Aspect fitted bounds #4
Comments
Take the 3-columns for example: each column is 100 in width. If the image is 150_180, after calculation, the frame size for its cell shall be 100_120. This frame will make the imageview itself resize by scale. The key point is, knowing the height for each image, and then calculate the frame. In the demo, I just use random heights for each cell, not the real height of the images, so there are margins if you UIViewContentModeScaleAspectFit is used for the contentMode. I suggest try it with images of which heights are already known, otherwise the frames may not be very precise. |
I see that it's possible now, just using the flowView:heightForRowAtIndexPath: method. I'll try it out. Thanks. |
you're most welcome |
Just curious, but have you done any other layout prototypes similar to this? I'm looking to build something like iPhoto for iOS's journals, or what is seen on 500px.com. It is similar to your layout, but allows images to span multiple columns. I like masonry layouts but feel they focus too much on portrait-oriented images at the expense of landscape orientations-- because an image can be as tall as it wishes, but can only be as wide as its column. |
hi Alaric, shame that i didn't look deep into the organism of iPhoto myself because I haven't got one on my devie... but from the display of 500px.com, i assume that the layout is based on a table (which i thinks make it easier than iPhoto in implement). Each row (or cell) is fixed in height, but what's inside depends on the pattern or template you choose. I can find 5 templates at least to split the cell into 2, 4 or 5 photos in 500px. Each time a cell is setup, how about using a template property for the way to split it? |
That's true. Looking into it more, 500px does crop their photos to fit within a few predefined templates. I suppose I'm looking into something more complex that would not crop images but would do something in between a pinterest and 500px style. Assuming images would typically have the same aspect, but with some vertical and some horizontal. On Jun 10, 2012, at 6:25 PM, Bertie Liureply@reply.github.com wrote:
|
I think about iPhoto journal for a while, based on a picture from http://www.techgatherer.com/wp-content/uploads/2012/03/iphoto-for-ipad-and-iphone-review-2pTEXC.png . It seems to me, that there are 5 kinds of size for pictures, and the rule for layout is, keep layouting until the pictures form a rectangle that could be taken as a cell for reuse. |
Hi Alaric, actually i've been looking into your idea and have got so far: http://ptzplace.lockerz.com/s/217315435. I'm not sure how apple made it, but my algorithm is to calculate the weights of photos based on a 40*40 square. If you're interested, you could reach via email for further discussion. |
Sure. What email address should I use? On Jun 15, 2012, at 3:24 AM, Bertie Liureply@reply.github.com wrote:
|
bertieliu52@gmail.com Gmail's good with me. |
Setting the contentMode of the UIImageViews to UIViewContentModeScaleAspectFit did not result in the expected layout. There was a lot of "whitespace" so to speak. Is there a way to use this layout engine with UIViewContentModeScaleAspectFit or UIViewContentModeScaleAspectFill?
The text was updated successfully, but these errors were encountered: