Skip to content
This repository was archived by the owner on Feb 2, 2023. It is now read-only.

Conversation

@jflinter
Copy link

This adds several UIResponder methods to ASDisplayNode, further increasing its API-compatibility with UIView. These methods include:

  • canBecomeFirstResponder
  • becomeFirstResponder
  • canResignFirstResponder
  • resignFirstResponder
  • isFirstResponder
  • canPerformAction:withSender

These by default just forward along to their underlying _ASDisplayView, which should already implement them correctly. The exception to this is canBecomeFirstResponder and canResignFirstResponder, which by default return NO and YES, respectively (this is so the _ASDisplayView can in turn ask its ASDisplayNode if it can become the first responder without having to expose _ASDisplayView directly).

I put this together to make it easy to close #11. However, the work's not fully done: it's still up to implementors to actually create a copyable ASTextNode subclass. This is intentional - that's pretty much the state of things with UILabel as well (see nshipster.com/uimenucontroller/ for an example of how to properly subclass and implement this). If you'd like me to contribute an ASCopyableTextNode class, I'd be happy to, although it feels a bit out-of-scope for this library.

@appleguy
Copy link
Contributor

Ah, this is very interesting — I appreciate the investigation @jflinter . I'd like to merge this and very much support the general direction, but have a couple concerns:

  • Have you carefully considered what will happen for layer-backed or subtree-precomposited (rasterized) nodes?
  • Can you think of a way we could evaluate the performance overhead of returning non-default values for the first responder properties? It is a vague concern right now, but I worry that this could somehow increase the substantial UIKit overhead that is seen with -addSubview: and -removeFromSuperview as those operations scan the hierarchy to update the first responder.

Could you share one or two use cases that you've run into for these features? I think we should also include at least a couple unit tests for this kind of functionality, to make sure it behaves in a consistent way with layer-backing, pre compositing, and the desired behavior itself.

@jflinter jflinter closed this Jun 27, 2015
fruitcoder pushed a commit to digitalegarage/AsyncDisplayKit that referenced this pull request Sep 6, 2017
- During the first layout calculation, measure more than just elements in the visible viewport.
- Remove unnecessary params in `-[ASCollectionLayoutState getAndRemoveUnmeasuredLayoutAttributesPageTableInRect`.]
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[ASDisplayNode] Support UIMenuController

3 participants