开发者

Do you have to create a View Controller to move between views?

开发者 https://www.devze.com 2022-12-26 18:50 出处:网络
I want a single startup view with a button and a welcome screen. When the button is pressed I then want to navigate to a second view which contains a table view and toolbar.

I want a single startup view with a button and a welcome screen. When the button is pressed I then want to navigate to a second view which contains a table view and toolbar.

I've tried creating a ViewController but my button is shown on all views. I just want a single view, then when it's pressed i go to the next view and the 're开发者_StackOverflow社区al' app starts. Can someone please try and explain the best architecture to do this?

(like in chapter 6 of beginning iPhone 3 Development by Dave Mark and Jeff LaMarche )

Thanks


Are u developing for the iphone or ipad, if its for the iphone then have u looked into UINavigationControllers? These allow you to interchange from view controller to view controller in an easy fashion.

So for your problem I would have 2 view controllers one for the startup and one for the table view view controller. Assuming you set up the Navigation controller right (which you can easily by starting a new project with a navigation based viewcontroller through xcode), then you can use [navigationController pushViewController:viewCOntroller) method to present your view controllers view, also viewcontrollers have their navigationController as a property, so when the button is clicked all you should have to do it

new up the viewcontroller whose view you want to display and call (from the current view controller ) [self.navigationController pushViewController:] method to display your second view controller. release the view controller u just pushed Navigation Controllers also have a navigationBar property which you can use to go back and forth between view controllers.. heres the class reference and it contains a guide of how to use these..Navigation Controller Reference

0

精彩评论

暂无评论...
验证码 换一张
取 消