Closed HelloButler closed 5 years ago
cellConfigAtConfigure
cannot be used like that to get properties of the row. It is just used to store values of properties which will later be set on the row. What you could do is setting the controller as a delegate to the row
I am new to Objective c, how to do that? a example will be appreciated :) this is normal way to do that, but with xlfrom, there's not such thing like cell instance;
(UITableViewCell )tableView:(UITableView )tableView cellForRowAtIndexPath:(NSIndexPath )indexPath { PreferentialCell cell = [tableView dequeueReusableCellWithIdentifier:@"preferentialCell" forIndexPath:indexPath];
YXHGoods *goods = self.dataArray[indexPath.row]; cell.goods = goods;
__weak typeof(self) wself = self; cell.onClickShareButtonHandler = ^(YXHGoods model) { [wself _handleShareEventWithGoods:model]; //button in PreferentialCell }; cell.onClickCommentButtonHandler = ^(YXHGoods model) { [wself _handleCommentEventWithGoods:model];////button in PreferentialCell };
return cell ; }
I did this in Swift but there should be a way in Objc as well:
@objc protocol RateCellDelegate: class {
func rated(value: Float) -> Void
}
class XLFormRatingCell : XLFormBaseCell {
@IBOutlet weak var rateTitle: UILabel!
@IBOutlet weak var ratingView: XLRatingView!
@objc weak var delegate: RateCellDelegate?
// ....
@objc func rateChanged(_ ratingView : XLRatingView){
rowDescriptor!.value = ratingView.value
delegate?.rated(value: ratingView.value)
}
}
And in the view controller:
row.cellConfigAtConfigure["delegate"] = self
I did it alternative way, thx anyway:)
inside a ViewController.m
anyone have idea?