I am playing with some UITableView coding and tried to hide the default textLabel property. I used the UIScrollViewDelegate protocol and used both -scrollViewDidScroll and scrollViewDidEndDecelerating methods to hide and show the label.
The code works fine just with the first row of the table and not all of them which is what I want. Here's my code:
*Edited to show the solution code.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
cell = [self.tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath];
cell.textLabel.hidden = NO;
cell.textLabel.text = @"TEST";
return cell;
}
-(void)scrollViewDidScroll:(UIScrollView *)scrollView {
for (cell in [self.tableView visibleCells]) {
cell.textLabel.hidden = YES;
}
}
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView {
for (cell in [self.tableView visibleCells]) {
cell.textLabel.hidden = NO;
}
}
So anyone could help me to hide and show all the rows?