You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to retrieve the frame of an ASCellNode within its container ASTableNode. I need this to animate transition of the cell to next screen.
When I called tableNode.convert(cell.frame, from: cell), I expected to return the cell frame in the table coordinate. instead I get error: Could not find a common ancestor between node1: <MyCellNode: 0x7fee331bb000> and node2: <ASTableNode: 0x7fee32e0d5d0>
This is weird, can a table node not the ancestor of a cell node?
This can be reproduced by adding two lines to AsyncDisplayKit/examples/ASViewControllerSample/ViewController.m
- (void)tableNode:(ASTableNode *)tableNode didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
// add these two lines to get the Rect of the cell node...
// it will crash the app when user tap a row
ASCellNode* cell = [tableNode nodeForRowAtIndexPath:indexPath];
CGRect rect = [tableNode convertRect:cell.frame fromNode:cell];
NSString *imageCategory = self.imageCategories[indexPath.row];
DetailRootNode *detailRootNode = [[DetailRootNode alloc] initWithImageCategory:imageCategory];
DetailViewController *detailViewController = [[DetailViewController alloc] initWithNode:detailRootNode];
detailViewController.title = [imageCategory capitalizedString];
[self.navigationController pushViewController:detailViewController animated:YES];
}
The text was updated successfully, but these errors were encountered:
@siuying Ah that makes sense – the cell node is not a direct subnode of the table node. The cell node is inside a view (the UITableViewCell) which is inside the table view.
Instead use -[ASTableNode rectForRowAtIndexPath:] to get the rect in the table node's coordinate system. Thanks for raising the issue and sorry for the confusion!
I tried to retrieve the frame of an ASCellNode within its container ASTableNode. I need this to animate transition of the cell to next screen.
When I called
tableNode.convert(cell.frame, from: cell)
, I expected to return the cell frame in the table coordinate. instead I get error:Could not find a common ancestor between node1: <MyCellNode: 0x7fee331bb000> and node2: <ASTableNode: 0x7fee32e0d5d0>
This is weird, can a table node not the ancestor of a cell node?
This can be reproduced by adding two lines to
AsyncDisplayKit/examples/ASViewControllerSample/ViewController.m
The text was updated successfully, but these errors were encountered: