Let me explain what I am trying to achieve.

Here's my application with an NSScrollView, and it's documentView (which is
an NSView subclass) implements a method

-(NSRect)adjustScroll:(NSRect)newVisible {

    NSRect modifiedRect = newVisible;

    modifiedRect.origin.y = (int)(modifiedRect.origin.y/50.0)*50.0;

    return modifiedRect;

}

This is what my running app looks like (it's a 300 KB screen capture video
file):
http://rghost.net/download/6xkClpQ6h/b1829f6195168b62fad853fc96c73c42a998b367/MyApp.mov

On the other hand, this is what Calendar's scrolling looks like (notice how
smoothly it gravitates to make the week rows always fit into the view
completely):
(3 MB video)
http://rghost.net/download/6G2jf9Xgy/b49a74b9d0877d2b6324aca37c481f636e070b8b/CalendarApp.mov

I am trying to have a similar "smooth" scrolling adjustment animation
effect, instead of jerky scrolling I have now with adjustScroll.
But I don't know how Apple did it.
Can you give me some hints, if anyone faced with a similar problem?

Thank you




2015-10-26 20:16 GMT+02:00 Nick <eveningn...@gmail.com>:

> Hi
> I am developing an application that looks similar to the OS X's
> Calendar.app.
>
> One of the nice features it has is the "gravity effect" to the grid lines,
> when the user performs vertical scrolling - if you scroll the calendar so
> that half-row is clipped by the Clip View, it automatically scrolls
>  further until the whole row fits into the view.
>
> Documentation says that we should implement the adjustScroll method of the
> document view, where, given a proposed NSRect, we can update it however we
> want.
> I did implement this method, and it works, but the problem is that now
> scrolling is not smooth at all - It just scrolls "line by line", as it does
> in Windows (as in I move two fingers on the trackpad - and get lines simply
> displayed one after the other). Is this the intended behavior? If it is,
> how did Apple developers make their  Calendar "adjustScroll"-ed scrolling
> so smooth? Or is there anything wrong in my code i should be looking to fix?
>
> Thank you
>
_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to