How to correctly add a view to a UIStackView

MaxMacFarlaneMaxMacFarlane USMember ✭✭

I am new to iOS development and was wondering what is the correct way to add a view to UIStackView.

What i am trying to achieve is have a main view which contains a button and a stackview and when the button is clicked it calls another viewcontroller which returns the viewcontroller then I want to add that to the stackview.

This is the code snippet from the button on the main view.

btnAdd.TouchUpInside += (s, e) => { var child = new OtherController(); stackView.AddArrangedSubview(child.View); };

This does correctly populate the stackview however the button events which are set in the OtherController() are not being fired.

I'm sure its something simple that I'm over looking just cant see it. Thanks.

Best Answer


Sign In or Register to comment.