• 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: Responsive scrolling control with lots of subviews
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Responsive scrolling control with lots of subviews


  • Subject: Re: Responsive scrolling control with lots of subviews
  • From: Ken Thomases <email@hidden>
  • Date: Mon, 02 Mar 2015 10:41:44 -0600

On Mar 2, 2015, at 8:54 AM, Ben <email@hidden> wrote:

> From a time profile, the majority of my code being called is funnelled through a single method which handles the adding/positioning/removing of views within the visible area. The slow areas are:
>
> 8% - Instantiating new views (happens early on, views are cached for reuse)
> 20% - Positioning new/reused views (a single -setFrame: call once for each view)
> 25% - Adding newly-visible subviews (-addSubview:)
> 17% - Enumerating off-screen columns for view removal (-removeFromSuperviewWithoutNeedingDisplay)
> 25% - Enumerating off-screen rows for view removal (-removeFromSuperviewWithoutNeedingDisplay)
> Remainder is misc small stuff. This method as a whole takes 19% of running time.

What are you considering "visible" or "the visible area"?  For responsive scrolling, you don't want to limit it to the document view's visible rect.  You want to use the preparedContentRect and override -prepareContentInRect: to be told when that is changing.

Review this list of the "secondary" requirements to participate in responsive scrolling, from the AppKit release notes for 10.9 (not currently available online):

The list of secondary requirements are:

* Do not override -scrollWheel: in an NSScrollView, NSClipView subclass, or in the document view. (See the event modal notes in this section)

* Do not override -drawRect: in an NSScrollView subclass

* Do not override -lockFocus: in an NSScrollView, NSClipView subclass, or in the document view.

Layer backed secondary requirements:

* The root layer must be either the NSScrollView or an ancestor view

Traditional drawing secondary requirements:

* copiesOnScroll must be set to YES on the NSClipView

* The documentView must override -isOpaque and return YES

Regards,
Ken


_______________________________________________

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


References: 
 >Responsive scrolling control with lots of subviews (From: Ben <email@hidden>)
 >Re: Responsive scrolling control with lots of subviews (From: Mike Abdullah <email@hidden>)
 >Re: Responsive scrolling control with lots of subviews (From: Ben <email@hidden>)

  • Prev by Date: Re: Application windows are expected to have a root view controller at the end of application launch
  • Next by Date: Re: Responsive scrolling control with lots of subviews
  • Previous by thread: Re: Responsive scrolling control with lots of subviews
  • Next by thread: Re: Responsive scrolling control with lots of subviews
  • Index(es):
    • Date
    • Thread