user903772
user903772

Reputation: 1562

IOS View controller communicate

Hi I have a view controller A that deal with view A, and a view controller B for view B. Now to go to view B when user click a button in view A?

Upvotes: 0

Views: 165

Answers (4)

LJ Wilson
LJ Wilson

Reputation: 14427

If you are using Storyboard this becomes much much easier. Just select the scene for View A in the Storyboard view, then on the Menu bar, Click Editor->Embed In->Navigation Controller. This will add the Nav Controller automagically and make View A the Root View Controller. Then it is just a matter of wiring up a Segue from View A to View B.

Upvotes: 0

三界之外
三界之外

Reputation: 11

You can create a UINavigationController , the NavigationController's rootViewController is view A . When the user clicks the button at view A, push View controller B onto the NavigationController. use this method: pushViewController:

good luck with you!

Upvotes: 1

Chris
Chris

Reputation: 811

Create an IBAction method for the button, initialize your view B, and push it onto the view stack.

This is very well documented in the documentation. You should check it out!

Upvotes: 0

Aaron Hayman
Aaron Hayman

Reputation: 8502

Push View Controller A onto a UINavigationController to begin with. When the user clicks on the button in view A, push View Controller B onto the navigation controller.

Upvotes: 0

Related Questions