iOS 7 - Tabelview editable

Asked

Viewed 127 times

2

I’m trying to create a Tableview with the same actions (Add/Edit/Delete Rows) of the native app (Phone) as shown below, but I’m not getting it.

inserir a descrição da imagem aqui

I would like to create a field "(+) add item" (which inserts a new line) and then a form with fields where, I click and can already edit it, insert information like tags (ex: Home, Mobile, Commercial), phone number, email, plus delete button(-)

1 answer

4

For this you need to create a custom Uitableviewcell. Let’s focus the problem on entering data just like adding phone. First, make a Uitableviewcell like this:

inserir a descrição da imagem aqui

For this, you do not need a subclass of Uitableviewcell because the native already has everything you need. Assemble the layout (storyboard) just insert a button into the cell, and a label, and install Cell according to your Dentifier. The action of this Cell on the didSelectRowAtIndexPath will be an insertRowsAtIndexPaths, which will insert a custom Cell:

Create A new class that extends from Uitableviewcell, and mount the layout (storyboard) of it as the below:

inserir a descrição da imagem aqui

This Uitableviewcell is more complex, it has several functionalities, as the button that selects the type of phone, Swipe, etc... all this should be implemented in this custom Uitableviewcell.

I believe the links below can help you follow this path:

To understand the delegate of the Cell selection: https://stackoverflow.com/questions/8404922/uitableview-didselectrowatindexpath

https://developer.apple.com/library/ios/documentation/uikit/reference/UITableViewDelegate_Protocol/Reference/Reference.html

To understand how to create a custom Uitableviewcell http://www.appcoda.com/customize-table-view-cells-for-uitableview/

To create a Cell with Swipe

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

https://stackoverflow.com/questions/17254402/swipe-to-delete-and-the-more-button-like-in-mail-app-on-ios-7

Your question has no direct doubt, it encompasses a number of techniques. Anyway I hope this will help.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.