{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/229","labels_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/229/labels{/name}","comments_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/229/comments","events_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/229/events","html_url":"https://github.com/facebook/AsyncDisplayKit/issues/229","id":54535494,"number":229,"title":"Using intrinsically sized UIViews in an ASDisplayNode subclass","user":{"login":"ide","id":379606,"avatar_url":"https://avatars.githubusercontent.com/u/379606?v=3","gravatar_id":"","url":"https://api.github.com/users/ide","html_url":"https://github.com/ide","followers_url":"https://api.github.com/users/ide/followers","following_url":"https://api.github.com/users/ide/following{/other_user}","gists_url":"https://api.github.com/users/ide/gists{/gist_id}","starred_url":"https://api.github.com/users/ide/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ide/subscriptions","organizations_url":"https://api.github.com/users/ide/orgs","repos_url":"https://api.github.com/users/ide/repos","events_url":"https://api.github.com/users/ide/events{/privacy}","received_events_url":"https://api.github.com/users/ide/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/labels/discussion","name":"discussion","color":"cc317c"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-01-16T03:15:18Z","updated_at":"2015-01-24T18:04:45Z","closed_at":null,"body":"I'm writing a custom ASDisplayNode that contains a UIButton (my reason for this being that system UIButtons come with a bunch of established behaviors Apple has implemented) and am trying to figure out when to measure the UIButton with `sizeToFit` or `sizeThatFits:`.\r\n\r\nThe tricky part is that the UIButton's intrinsic size affects my ASDisplayNode's calculated size, so the UIButton needs to be measured before `calculateSizeThatFits:` returns. Right now I'm just sizing the UIButton in `calculateSizeThatFits:`, but from the ASDK source it looks like that code could be running on a background queue. In practice it seems to be fine but I'd prefer to use UIKit mostly on the main queue.\r\n\r\nIs there a good approach here? One solution I can think of is to make `calculateSizeThatFits:` take a callback so that it can dispatch to the main queue, measure UIKit components, and then invoke the callback. (This would also allow node subclasses to call `measure:` on several subnodes for parallel layout.) The other solution would be to call `measure:` on the root node from the main queue but it kind of sucks that one UIView would make the whole node hierarchy layout on the main thread.\r\n"},"comment":{"url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/comments/71329836","html_url":"https://github.com/facebook/AsyncDisplayKit/issues/229#issuecomment-71329836","issue_url":"https://api.github.com/repos/facebook/AsyncDisplayKit/issues/229","id":71329836,"user":{"login":"secretiverhyme","id":735630,"avatar_url":"https://avatars.githubusercontent.com/u/735630?v=3","gravatar_id":"","url":"https://api.github.com/users/secretiverhyme","html_url":"https://github.com/secretiverhyme","followers_url":"https://api.github.com/users/secretiverhyme/followers","following_url":"https://api.github.com/users/secretiverhyme/following{/other_user}","gists_url":"https://api.github.com/users/secretiverhyme/gists{/gist_id}","starred_url":"https://api.github.com/users/secretiverhyme/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/secretiverhyme/subscriptions","organizations_url":"https://api.github.com/users/secretiverhyme/orgs","repos_url":"https://api.github.com/users/secretiverhyme/repos","events_url":"https://api.github.com/users/secretiverhyme/events{/privacy}","received_events_url":"https://api.github.com/users/secretiverhyme/received_events","type":"User","site_admin":false},"created_at":"2015-01-24T18:04:45Z","updated_at":"2015-01-24T18:04:45Z","body":"> it's a form component, so it doesn't look like I can use ASTextNode\r\n\r\n&\r\n\r\n> I'm also very interested in a growing UITextView in a custom ASDisplayNode.\r\n\r\n[ASEditableTextNode](https://github.com/facebook/AsyncDisplayKit/blob/master/AsyncDisplayKit/ASEditableTextNode.h) is now available in master if you'd like to try it, and will be included in the upcoming AsyncDisplayKit 1.2 release.  =]"}}