Nnp
Nnp

Reputation: 1853

editing style for custom UITableViewCell

how do i set editing style for custom UItableviewcell like this image.alt text

this is shopping cart view ,so i am gonna have many UITableViewCell, out of other fields only Qty field is going to be editable. thanks

Upvotes: 1

Views: 1714

Answers (2)

Nnp
Nnp

Reputation: 1853

i have figure out some way, i dont know its the right way,but it works for me, but still waiting the most correct way. here is what i did,

1) i have created a IBOutlat for my UIButton in my EditCellView (subclass of UITableviewcell)
2) and then i create IBAction in my tableviewcontroller
3) then i set UIButton Touch in event to IBAction in tableviewcontroller
4) in IBaction method you can get that cell using this code

EditItemController *cell =  (EditItemController *)[[sender superview] superview];
NSIndexPath *indexPath = [self.maintable indexPathForCell:cell];

this line of code may depends on your view layout

[[sender superview] superview]

to get correct superview you can use following command in gdb

gdb>po [[sender superview] superview]

Upvotes: 0

futureelite7
futureelite7

Reputation: 11502

The cell above looks like a custom button. What you can do is to add two UIButtons to a subclass of UITableViewCell, as well as a UITextField, and add event handling code for clicking the UIButtons to update the quantity. Since you can use an image for UIButtons achieving the above look shouldn't be difficult.

Upvotes: 2

Related Questions