Próbuję uzyskać dostęp do wysokości TableViewCell wewnątrz setProperty komórki.Uzyskaj wysokość wiersza aktualizacji w komórce po wysokościForRowAtIndexPath
Tworzę komórkę poprzez XIb a następnie zmieniając wysokość na podstawie wartości zwracane w heightForRowAtIndexPath
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
return 200;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
RightGuideCell* cell = [tableView dequeueReusableCellWithIdentifier:@"cellId"];
cell.ticks = @[@"1",@"1",@"1",@"1",@"1",@"1",@"1"];
return cell;
}
Jest to nieruchomość w celi.
- (void)setTicks:(NSArray *)ticks {
_ticks = ticks;
CGFloat height = self.frame.size.height; //Value is 44 (size in xib)
}
Jak mogę uzyskać 200 (w zestawie heightForRowAtIndexPath
) w komórce?
Wysokość jest już obliczana w komórceForRowAtIndexPath, więc może być konieczne ponowne załadowanie komórki po tym. To dostanie nową wysokość, ale może być trochę ciężko ressource. – Tobias