I am a new iPhone developer learning Objective-C, and trying to build an iPhone app using a Navigation-Based template. The way I want this application to function is to have a button, which takes the user to the second screen after being pressed. Unfortunately, I have not seen any examples of this online, and am unsure how to do this.
I realize that I won’t be using a table view, where I would select a particular row that would then take me to another screen. What view would be appropriate to have a button, and possibly a search bar on the first screen, which would then allow me to navigate over to a second screen? I would need the second screen to have a table view which would hold a list of rows retrieved from a sqlite database. What method in the RootViewController (i.e. the first screen) would I use to place the code to execute when the button is selected (i.e. fires an event)?
Not sure I understand you question correctly, but…
In RootViewController:
The
addTarget:action:forControlEvent:selector registers the ‘callback’ that should be called every time the button is pressed. In the callback (onButtonPressed) you just create new controller and push it into the navigation controller.Usually you should do it in the Interface Builder. Just add
IBActionand connect it to the event.