Re: Animating row height changes for view-based table view
Re: Animating row height changes for view-based table view
- Subject: Re: Animating row height changes for view-based table view
- From: Martin Hewitson <email@hidden>
- Date: Sun, 07 Apr 2013 16:58:30 +0200
Uli, thanks a lot for the detailed thoughts! I'll have a go. Not sure how to schedule an animated scroll, but hopefully google will help me there :)
Many thanks again,
Martin
On 7, Apr, 2013, at 04:04 PM, Uli Kusterer <email@hidden> wrote:
> On 07.04.2013, at 10:26, Martin Hewitson <email@hidden> wrote:
>> So, in short, the expanding of the rows works nicely, except for the NSViews which should be hidden/revealed move in the view, despite having deselected the necessary struts in IB (haven't tried auto-layout here yet).
>
> The coordinate system starts in the lower left. If you have no struts set and make the superview smaller, those views are effectively pinned to the lower left. Have you tried pinning the views to the upper left? Then they should stay in place and be clipped by the superview.
>
>> And, I need a better way to scroll the full row to be visible.
>
> Calculate it yourself:
>
> 1) Get the visible rect of the scroll view and the rect that the enlarged cell view would be. Make sure they're both in the same coordinate system (i.e. the scroll document view's coordinate system).
>
> 2) Calculate the difference between the bottom of the cell and the bottom of the visible rect. If the visible rect is larger, make a note to scroll up by that many pixels, so the bottom is just in view.
>
> 3) Calculate difference between the tops *after* applying the scroll from #2. If the visible top is smaller than the cell's top, subtract the difference from the scroll from #2. (This means that the top will always be visible if you un-collapse the view, even if the row is taller than the visible area)
>
> 4) Schedule an animated scroll to be at the same time as the animation that enlarges the cell.
>
> 5) PROFIT.
>
> Cheers,
> -- Uli Kusterer
> "The Witnesses of TeachText are everywhere..."
> http://www.zathras.de
>
>
>
_______________________________________________
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