Aleksandr Maybach
Aleksandr Maybach

Reputation: 610

How to add and display new subnode on button tap?

I have ASViewController with root node. In init I add some nodes. I need to display new node after button tap. How I can do it?

Upvotes: 0

Views: 222

Answers (1)

Bimawa
Bimawa

Reputation: 3700

Just use Layout Transition

- (ASLayoutSpec *)layoutSpecThatFits:(ASSizeRange)constrainedSize
{


  ASStackLayoutSpec *stack = [[ASStackLayoutSpec alloc] init];
  if (self.buttonState == SignupNodeName) {
    [stack setChildren:@[field, self.buttonNode, self.newNode]];
  } else {
    [stack setChildren:@[field, self.buttonNode]];
  }


  UIEdgeInsets insets = UIEdgeInsetsMake(15.0, 15.0, 15.0, 15.0);
  return [ASInsetLayoutSpec insetLayoutSpecWithInsets:insets child:stack];
}

Upvotes: 2

Related Questions