Getting data from TableView
I am learning how to program in Objective-C (I currently have some experience with C, and have worked with very basic Objective-C).
I found a sample code for having anchored column. One thing that I like about it is that multiple data can be entered by the user into the table in the project. (Kind of like an address book)
I was trying to have it so that the entered data into this project is saved (maybe as a plist or otherwise). However, I have no clue how to get the data after it is entered into the table. The project can be downloaded from http://dl.dropbox.com/u/7822960/AnchoredColumn.zi开发者_StackOverflowp
I would highly appreciate it if someone could help me out by showing me how to do this.(If it is easier, could someone modify the "Click Me" button so that the first user-entered name is displayed into the text box). Or, if there is a sample code out there that does something similar to this.
First thing you have to understand is that YOU supply the data for the table. The table holds no data. It simply displays it. Read up on UITableViewDelegate
and UITableViewDataSource
. And since you have some sample code, go look at the method that is called when the Click Me button is tapped. I bet you that in that method, an object is being create and added to an array which is what is feeding the table when the table data source delegate methods are called. (And those delegate methods are likely defined in the same .m file.)
精彩评论