I am embeding JBParallaxCell
, a UITableViewCell
subclass. I want to call a function:
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
// Get visible cells on table view.
NSArray *visibleCells = [self.tableView visibleCells];
for (JBParallaxCell *cell in visibleCells) {
[cell cellOnTableView:self.tableView didScrollOnView:self.view];
}
}
I converted this code to Swift:
func scrollViewDidScroll(_ scrollView: UIScrollView) {
let visibleCells = table.visibleCells
var cells : JBParallaxCell?
for cells in visibleCells {
cells(on: table, didScrollOn: self.view)
// cells.cellOnTableView(tableView: table, didScrollOn: self.view)
}
}
They give error call not function of UITableViewCell
If your tableview outlet is called
table
, then you'd could do:Or, equivalent:
You need to convert
[cell cellOnTableView:self.tableView didScrollOnView:self.view];
to swift and add it in JBParallaxCell. I converted it myselfAnd change this line
let visibleCells = table.visibleCells
to