Thursday, September 22, 2011

Do you know Objective-c?: How navigate in UITableView

As we saw how we can define a UITableView, set its properties and personalize it, now we are going to learn how to navigate in our UITableView designed in the post which we talked about UITableView, which we customize with two rows and sections that depended by the contents of array.
At first we have to define the UINavigationController in one of our events: ApplicationDidFinishLaunching. We do it like that:


After this, we have to add a UIViewController to our project which will be personalized with a method of writing in a UILabel and change it with a UIButton like our 'HelloWorld' example.


We have to select the correct subclass for our code:











We continue adding variables and methods to the new class we have created. We define an UILabel, UIButton with their respective methods set them in files .h & .m


The appearance of our new View will be customized with a button and a label as we said.


By last, we have to add what happens when a row was select. We had two arrays, that's why I evaluate what section I select it.


After all, we obtain a simple application like this:




No comments: