iOS 7 - Editable TabelView

2

I'm trying to create a TableView with the same actions (Add / Edit / Delete rows) as the native app (Phone) as below, but I'm not getting it.

Iwouldliketocreateafield"(+) add item" (which inserts a new line) and then a form with fields where, I click and I can already edit it, insert information as labels (eg Home, Mobile, Commercial), phone number, email, plus the delete (-) button

    
asked by anonymous 07.07.2014 / 05:50

1 answer

4

For this you need to create a custom UITableViewCell. Let's focus on inserting data just like adding a phone. First, make a UITableViewCell like this:

Todothis,youdonotneedasubclassofUITableViewCellbecausethenativealreadyhaseverythingyouneed.Mountthelayout(storyboard)justinsertabuttoninthecell,andalabel,andinstanciethecellaccordingtoitsidentifier.TheactionofthiscellindidSelectRowAtIndexPathwillbeaninsertRowsAtIndexPaths,whichwillinsertacustomcell:

CreateanewclassthatextendsfromUITableViewCell,andmountitsstoryboardasbelow:

This UITableViewCell is more complex, it has several features, such as the button that selects the type of phone, the swipe, etc ... this should all be implemented in this custom UITableViewCell.

I believe the links below may help you to follow this path:

To understand the Cell selection delegate: link

link

To understand how to create a custom UITableViewCell link

To create a Cell with swipe

-(void)tableView:(UITableView *)tableView swipeAccessoryButtonPushedForRowAtIndexPath:     (NSIndexPath *)indexPath;

link

Your question does not have a direct doubt, it encompasses a number of techniques. Anyway I hope this helps.

    
11.07.2014 / 22:11