简体   繁体   English

单击按钮即可从UITableViewController访问UITableViewCell

[英]Access UITableViewCell from UITableViewController on button click

Got a UIStepper inside a UITableViewCell (IBAction). 在UITableViewCell(IBAction)中有一个UIStepper。 What I would like is to reset its value property back to 0 from the UITableViewController on a button press (another IBAction). 我想要的是在按下按钮时将UITableViewController的value属性重置为0(另一个IBAction)。

So how can I access my dynamic cells from an a UITableViewController IBAction? 那么如何从UITableViewController IBAction访问动态单元格呢?

Eventually I ended up adding a boolean property named shouldResetToZero in the model representing the cell. 最终,我最终在代表该单元格的模型中添加了一个名为shouldResetToZero的布尔属性。 I would set this to TRUE from the UITableViewController on button press and update the stepper if it's true in cellForRowAtIndexPath. 我将在按钮按下时从UITableViewController将此值设置为TRUE,如果在cellForRowAtIndexPath中为true,则更新步进器。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何从UiTableViewController访问自定义UITableViewCell上的属性? - How to access properties on a custom UITableViewCell from a UiTableViewController? 如何从子类的UITableViewCell中访问UITableViewController变量? - How to access UITableViewController variable from within a subclass'ed UITableViewCell? 将数据从UItableviewController传递到UItableViewcell - passing data from UItableviewController to UItableViewcell 从UITableViewController发送消息到UITableViewCell - Send message to UITableViewCell from UITableViewController 单击单元格中的按钮获取 UITableViewCell 的 indexPath - get indexPath of UITableViewCell on click of Button from Cell 如何从 UITableViewCell 类引用 UITableViewController? - How to reference UITableViewController from a UITableViewCell class? 在iOS中将数据从UItableviewController传递到UItableViewcell - Passing data from UItableviewController to UItableViewcell in ios 如何将数据从 uitableviewcontroller 发送到 uitableviewcell - how to send data from uitableviewcontroller to uitableviewcell 将选择器从UITableViewCell类添加到UITableViewController类 - Add a Selector from a UITableViewCell class to the UITableViewController class 快速从UITableViewCell删除存储在UITableViewController中的数据 - Swift remove data stored in UITableViewController from UITableViewCell
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM