• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Smooth adjustScroll of NSScrollView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Smooth adjustScroll of NSScrollView


  • Subject: Re: Smooth adjustScroll of NSScrollView
  • From: Nick <email@hidden>
  • Date: Tue, 27 Oct 2015 10:48:40 +0200
  • X_v_e_cd: b61a4c32b30ad800ce296b1516dbc286
  • X_v_r_cd: fa7ef71db0dcf0d117dd1f21832f9d19

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 <email@hidden>:

> 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 (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


  • Follow-Ups:
    • Re: Smooth adjustScroll of NSScrollView
      • From: Jens Alfke <email@hidden>
References: 
 >Smooth adjustScroll of NSScrollView (From: Nick <email@hidden>)

  • Prev by Date: Re: Updated View Bounds After Orientation Change...
  • Next by Date: Re: Updated View Bounds After Orientation Change...
  • Previous by thread: Smooth adjustScroll of NSScrollView
  • Next by thread: Re: Smooth adjustScroll of NSScrollView
  • Index(es):
    • Date
    • Thread