Answer the question
In order to leave comments, you need to log in
How can I change the text of the second label as well?
Class BaseCell : UICollectionViewCell{
//button
//label1
//label2
//foo() {download data and change label1 & label2 text}
//foo2() {change label1 and Label2 text}
//button.addTarget(self, action: #selector(foo2), for: .touchUpInside)
}
class Cell1 : BaseCell {
addSubView(label1)
addSubView(button)
}
class Cell2 : BaseCell {
addSubView(label1)
}
Answer the question
In order to leave comments, you need to log in
`tableView.reloadData()`
You need to update the entire table, so you need to call a function that updates all cells.
You can also update all cells with animation
`- (void)reloadRowsAtIndexPaths:(NSArray *)indexPaths withRowAnimation:(UITableViewRowAnimation)animation
`
I don’t remember how it will be in swift.
For good:
- someone else should change the texts in the cells, not the cells. The cell only displays the information that comes to it.
So:
- the functions processing the data upload and pressing should be in some controller
- which, after processing the information, will update the models
- and after that it will say the collectionView - "Update"
- ... or update specific cells ... This is how it should be.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question