开发者

TableView adding the same functions to every view

开发者 https://www.devze.com 2023-02-08 12:10 出处:网络
Hey! I was wondering how I can make the tableview add the same functions (buttons, text fields etc.) to the view it adds.

Hey! I was wondering how I can make the tableview add the same functions (buttons, text fields etc.) to the view it adds.

This is how I was thinking.

I want it to work kinda like the contacts app.

The user clicks on an add button and Types in the name f that field in the table view. When the user taps on the text it will add a new view. And for every view it will add the exact same functions which in my case would be the buttons and开发者_JAVA技巧 the text fields.


You'll have to program each ui event and add table cells accordingly.

You should take a look at http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/TableViewCells/TableViewCells.html#//apple_ref/doc/uid/TP40007451-CH7-SW1

and

http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UITableView_Class/Reference/Reference.html#//apple_ref/occ/instm/UITableView/insertRowsAtIndexPaths:withRowAnimation:


Sounds like you want to do your own UITableViewCell. See the tableview programming guide: http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/TableView_iPhone/TableViewCells/TableViewCells.html%23//apple_ref/doc/uid/TP40007451-CH7-SW1


It sounds like you want to insert custom cells using

insertRowsAtIndexPaths:withRowAnimation:

Inserts rows in the receiver at the locations identified by an array of index paths, with an option to animate the insertion. (UITableView Reference)


NSMutableArray *toListInTable = [listOfViews retain];

When you try to add new view to the table view, just add it in toListInTable. Then just reload the tableview like [tableView reloadData];

Within the following method, just load the views from toListInTable

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath


Use Custom UITableViewCell :-)

0

精彩评论

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

关注公众号