我正在开发一个购物应用程序,其中我正在实施购物车。在我的应用程序中,当单击加号按钮时,我需要增加产品数量,单击减号按钮时减少产品数量。在这里我的问题是,当我点击加号按钮时,所有文本字段值在tableviewcell中发生变化。帮帮我吧,下面是 加号按钮操作方法如何在uitableviewcell中点击按钮时更改文本框的值iOS
-(IBAction)plusBtn:(UIButton*)plus
{
[self.tbleView beginUpdates];
UITableViewCell *clickedCell = (UITableViewCell *)[[plus superview] superview];
NSIndexPath *clickedButtonIndexPath = [self.tbleView indexPathForCell:clickedCell];
plus.tag = clickedButtonIndexPath.row;
quantity.tag = clickedButtonIndexPath.row;
_curr =_curr+1;
quantity.text = [NSString stringWithFormat:@"%d",_curr];
[self.tbleView endUpdates];
[self.tbleView reloadData];
}
这样
越来越..你的按钮
请添加您的'cellForRowAtIndexPath'和plusButton操作方法 – Lalji 2014-12-06 10:57:23
的代码,我已经添加的方法现在 – iOSDevp 2014-12-06 11:05:36
你有一个自定义单元格或您正在使用[细胞viewWithTag:XX]添加文本到文本框的数量? – 2014-12-06 11:12:53