Re: UITableView with multiple UIScrollView each having its own zoom scale?
Re: UITableView with multiple UIScrollView each having its own zoom scale?
- Subject: Re: UITableView with multiple UIScrollView each having its own zoom scale?
- From: Quincey Morris <email@hidden>
- Date: Tue, 07 Aug 2012 22:43:17 -0700
On Aug 7, 2012, at 22:10 , Laurent Daudelin <email@hidden> wrote:
> Here are some screen shots. The first one is when the table view appears. The second one is almost one screen scrolled down. All the pictures are larger than the image view displaying them but setting the scrollview zoom scale properly, each image fits in the scrollview. The 3rd screen shot is showing the first cell almost at the top, the one originally with the sunset. As you can see, the image is zoomed all the way in even though there was no double tap on the image.
It may be more useful to post code snippets than screenshots, but I'll take a wild guess based on the information so far.
In the data source method 'tableView:cellForRowAtIndexPath:', the cell hasn't had its size configured yet. It's either whatever the cell was in the nib (if a new cell instance was just created) or something else (if the cell is being recycled). That's going to make it awkward to configure the zoom scale for the image.
-- If you use the cell bounds, that's the wrong thing, because the cell is going to be resized just after.
-- If you use the expected row height, you would have to configure the view hierarchy inside the cell to autoresize properly (or get laid or properly, depending how you deal with resizing) AND you would have set the zoom scale so that it will come out as you want it *after* the resizing but also taking into account whatever resize behavior is configured.
(If taking the latter approach, it might be simpler if you resized the cell, at least its height, before returning it, but you'd have to be certain you could size it correctly.)
But really you'd be better off to defer calculating the zoom scale until after the cell is actually resized. I'm not sure offhand where the correct place to do this would be. Perhaps delegate method 'tableView:willDisplayCell:forRowAtIndexPath:'. Or perhaps the cell's 'layoutSubviews'.
Is any of that any use to you?
_______________________________________________
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