137 Commits

Author SHA1 Message Date
Ryan Nystrom
e60b51bbbf Dispatch main screen scale to main once and only once
fixes #183
2015-01-08 14:24:34 -08:00
Ryan Nystrom
ebe614b8c9 Dispatch lazy image downloaders to another thread
fixes #148
2015-01-07 16:22:39 -08:00
Nadine Salter
bacfcbd24d Merge pull request #202 from facebook/batch_insertion
Batch insertion for reload #200
2015-01-07 14:53:15 -08:00
Li Tan
b9c6f3de03 Fix crash in Flow Controller 2015-01-06 18:04:42 -08:00
Li Tan
3adb0b1b93 Batch insertion for reload 2015-01-06 17:43:16 -08:00
Ryan Nystrom
7b86303f20 Forward touch events to either the node or super
`_ASDisplayView` now forwards touch events to either super or it's node, depending on whether or not the node implements the methods.

fixes #199
2015-01-06 16:06:59 -08:00
Nadine Salter
146a83568f Merge pull request #194 from facebook/table-selection
Call touch methods on _ASDisplayView super
2015-01-05 17:39:16 -08:00
Nadine Salter
da9ba9f7ba Merge pull request #195 from facebook/text-context-passing
Safe calls in ASTextNodeRenderer
2015-01-05 17:29:04 -08:00
Ryan Nystrom
7e30b10f13 Safe calls in ASTextNodeRenderer
fixes #190
2014-12-30 11:22:49 -08:00
Ryan Nystrom
f3be4ee041 Call touch methods on _ASDisplayView super
Currently we miss calling `-[super touches*]` on `_ASDisplayView` touch events. We delegate handling to the node which then forwards all touch events to the *superview*, skipping the current view. This seems to have some side effects with `UITableView` and it's cells/content views.

fixes #188
2014-12-30 09:47:05 -08:00
Ryan Nystrom
0473ed0a44 Consistent curlies on methods 2014-12-29 14:18:35 -08:00
Li Tan
13c57020c1 Fix typo in reloadRowsAtIndexPaths 2014-12-26 08:59:01 -08:00
Li Tan
3c0d4b2c42 Remove bachUpdate and begin/endUpdate 2014-12-19 08:48:10 -08:00
Li Tan
9367ccc19c Remove bachUpdate and begin/endUpdate 2014-12-18 20:35:27 -08:00
Li Tan
0d97d754ef fix deletion 2014-12-18 18:35:20 -08:00
Li Tan
fee3892f95 use asyncDisplayNodePerformOnMainThread 2014-12-18 18:13:01 -08:00
Li Tan
77113c6698 make reloadData thread safe 2014-12-18 16:52:09 -08:00
Ryan Nystrom
7d065adce3 Merge pull request #180 from facebook/issue-179
Only create a placeholder with a valid size
2014-12-18 14:49:59 -08:00
Ryan Nystrom
118cb32e23 Only create a placeholder with a valid size
fixes #179
2014-12-18 14:45:01 -08:00
Nadine Salter
0053a96bd5 Merge pull request #177 from facebook/fix_insert_section
Fix insert section
2014-12-18 14:18:58 -08:00
Li Tan
e799ed9ea4 fix 2014-12-18 14:00:19 -08:00
Li Tan
3e6436245d fix inserting sections bug 2014-12-18 13:07:43 -08:00
Ryan Nystrom
912bc9d460 Fade out placeholders
Added an API to fade out a node's placeholder when it is finished rendering.

fixes #156
2014-12-18 12:53:15 -08:00
Nadine Salter
4886d3d1ad Merge pull request #168 from facebook/editing
Fix crash while deleting in multiple sections
2014-12-17 13:34:47 -08:00
Ryan Nystrom
6064d3c60f Skip creating placeholder if there is no size
fixes #158
2014-12-17 10:49:52 -08:00
Li Tan
a22c4a2761 Another case for deletion 2014-12-16 20:11:31 -08:00
Li Tan
ac86cd9523 Fix crash while deleting multiple sections 2014-12-16 20:04:20 -08:00
Nadine Salter
89a0a25347 Remove CATransaction hack.
ASRangeController previously enqueued display of individual nodes by
adding their views to the hierarchy, wrapping each `-addSubview:` call
in an explicit CATransaction to force displays to occur in order.  This
hack is no longer necessary -- kill it.
2014-12-16 14:10:04 -08:00
Nadine Salter
e754cc2024 Add ASCellNode type assertions (closes #161). 2014-12-16 13:15:28 -08:00
Li Tan
62248ee0eb Fix crash in reloadData 2014-12-15 22:36:57 -08:00
Ryan Nystrom
d27c8859c7 Node placeholder API
ASDisplayNodes now have an overidable method -placeholderImage that lets you provide a custom UIImage to display while a node is displaying asyncronously. The default implementation of this method returns nil and thus does nothing. A provided example project also demonstrates using the placeholder API.
2014-12-15 17:23:52 -08:00
Li Tan
8b303710b6 fix unncessary change in editing 2014-12-15 15:57:11 -08:00
Li Tan
f7f5988fcd Support editing in table view and collection view 2014-12-15 13:19:10 -08:00
Justin Pasqualini
e098e13884 Setting a node's background color shouldn't require calling setNeedsDisplay explicitly 2014-12-12 15:47:31 -08:00
Nadine Salter
d8c1d71f24 Merge pull request #144 from facebook/issue-107
Support UIViewContentModeCenter with ASImageNode
2014-12-09 11:52:47 -08:00
越凡
263db6f46c When doing refresh, we should cancel perform requests previously registered with performSelector:withObject:afterDelay: first, or it will do the sizeNextBlock twice with the same indexPath and then it will crash. 2014-12-07 14:26:09 +08:00
Ryan Nystrom
647a9409d6 Support UIViewContentModeCenter with ASImageNode 2014-12-05 15:25:55 -08:00
Nadine Salter
764650fb94 _ASTableViewProxy & _ASCollectionViewProxy fixes.
These weren't correctly handling teardown:  nilling the `asyncDelegate`
created a new selector-forwarding NSProxy that crashed and burned
because there was nowhere to forward to.  Nil everything correctly.

Tentatively fixes #121.
2014-12-04 16:29:57 -08:00
Nadine Salter
68a5b32b79 Merge pull request #140 from facebook/manual-display-part-deux
Update manual display logic
2014-12-04 12:57:03 -08:00
Nadine Salter
eb600b955a Merge pull request #139 from facebook/imagedownloader-ios7
ASBasicImageDownloader iOS 7 support
2014-12-04 12:56:06 -08:00
Ryan Nystrom
36cbea4f8f Update manual display logic
Postpone manual display until a future release when it can be called on any thread. Provide the current node manual display logic as a category on ASDisplayNode only available for ASRangeController. Deprecate -displayImmediately.
2014-12-04 11:55:17 -08:00
Ryan Nystrom
c645935631 ASBasicImageDownloader iOS 7 support
On iOS 7, NSURLSessionTask is actually a __NSCFURLSessionTask (private class) and our NSURLSessionTask category to add the associated object asyncdisplaykit_metadata was crashing on iOS 7 stating that there was no method. This commit changes the category to extend NSURLRequest as well as change NSURLSessionTask to NSURLSessionDownloadTask.
2014-12-04 11:25:36 -08:00
Nadine Salter
93ce2b38a2 Make ASNetworkImageNode Just Work.
Use ASBasicImageDownloader by default -- you can now do...

  ASNetworkImageNode *imageNode = [[ASNetworkImageNode alloc] init];
  imageNode.URL = [NSURL URLWithString:@"..."];
  [self.view addSubview:imageNode.view];

...and it'll do the right thing.
2014-12-03 17:31:56 -08:00
Nadine Salter
79e65342b1 Working-range-driven image loading.
Add a `usleep(1.0 * USEC_PER_SEC)` delay to ASBasicImageDownloader and
slowly scroll through the Kittens sample project.  Without this patch,
you'll see that images only start downloading after their purple
placeholders appear onscreen.  With it, images can download and render
before you scroll them onscreen, thanks to the working range.
2014-12-02 19:23:23 -08:00
Nadine Salter
db085c49be Support realistic display delays (for debugging).
ASDISPLAYNODE_DELAY_DISPLAY unconditionally delays *all* attempts to
execute display blocks, even those that have been cancelled.  Fix that.

The DELAY_DISPLAY debugging tool is intended to simulate the effect of
expensive draw calls -- it lets you test your app's behaviour under
conditions potentially even worse than an iPhone 4.  Unfortunately, the
current simulation is unusably incorrect, as can be demonstrated by
repeatedly scrolling up and down in the Kittens example project.

ASRangeController enqueues asynchronous display of ASTableView cell
nodes when they enter the working range, and suspends their display when
they exit.  On a slow device, this performs as desired, limiting
expensive display computation to the space of the working range.  In
the DELAY_DISPLAY simulation, the suspended displays are as expensive as
the executed ones, so ASRangeController becomes unusably slow.
2014-12-02 19:04:49 -08:00
Nadine Salter
1103f82a5c .preventOrCancelDisplay -> .displaySuspended.
Rename the ASDisplayNode property to match its _ASDisplayLayer
counterpart -- `displaySuspended` is more succinct and is a more
plausible name for a Cocoa BOOL property.
2014-12-02 18:06:11 -08:00
Nadine Salter
51f3073c33 ASDisplayNode.inWindow -> .inHierarchy.
This is a remnant from before `willAppear` and `didDisappear` were
renamed to better reflect their hierarchy-change status (being added to
the hierarchy != being visible).  May be useful for turians.
2014-12-02 18:06:11 -08:00
Nadine Salter
a30c087616 Clean up ASDisplayNode internal flags.
* Reorganise and rename `_flags` for clarity and consistency.
* Remove ambiguity between `implementsDisplay` and `hasClassDisplay`.
* Delete useless `hasWillDisplayAsyncLayer` check -- make it a simple
  subclass override point, as with `didDisplayAsyncLayer:`.
* Minor comment cleanup.
2014-12-02 18:06:11 -08:00
Nadine Salter
a53bc08eaf Merge pull request #127 from facebook/manual-display
Add -[ASDisplayNode display].
2014-12-02 17:49:55 -08:00
Ryan Nystrom
531be46dfd Cleaning up manual display per @secretiverhyme 2014-12-02 16:53:17 -08:00