Note that there are some explanatory texts on larger screens.

plurals
  1. POChange height of cell with change frame of content
    primarykey
    data
    text
    <p>I can make animating of changing row height but it is bad with UITableViewRowAnimationFade, because it's flickers when animate</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; self.title = @"Main VC"; selectedIndexes = [NSMutableDictionary new]; } - (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration { [self.tableView reloadData]; } - (BOOL)cellIsSelected:(NSIndexPath *)indexPath { NSNumber *selectedIndex = [selectedIndexes objectForKey:indexPath]; return selectedIndex == nil ? NO : [selectedIndex boolValue]; } - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { static BOOL noFirst; if (!indexPath.row &amp;&amp; !noFirst) { [selectedIndexes setObject:@(YES) forKey:indexPath]; noFirst = YES; } if ([self cellIsSelected:indexPath]) { UIImage *cellImage = HelperDf.dataArray[indexPath.row][@"image"]; CGFloat aspectRatioIndex = cellImage.size.height / cellImage.size.width; return [Utils screenWidth:self.interfaceOrientation] * aspectRatioIndex; } else { return heightCell; } } </code></pre> <p>My didSelectRowAtIndexPath</p> <pre><code>- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSMutableSet *insideSet = [NSMutableSet new]; [insideSet addObject:indexPath]; BOOL isSelected = ![self cellIsSelected:indexPath]; for (NSIndexPath *keyIndexPath in selectedIndexes) { [insideSet addObject:keyIndexPath]; } [selectedIndexes removeAllObjects]; [selectedIndexes setObject:@(isSelected) forKey:indexPath]; [tableView reloadRowsAtIndexPaths:insideSet.allObjects withRowAnimation:UITableViewRowAnimationNone]; } </code></pre> <p>So if I use <code>[tableView beginUpdates] [tableView endUpdates</code> it is problems with change frame of my labels and <code>numberOfLinew</code>. How I can change frames of my labels and other parametres, that I change in <code>cellForRowAtIndexPath</code> </p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"MainCell"; MainCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; NSDictionary *dataDictionary = HelperDf.dataArray[indexPath.row]; cell.titleLabel.text = dataDictionary[@"title"]; cell.descriptionLabel.width = [Utils screenWidth:self.interfaceOrientation] - 40; cell.descriptionLabel.text = dataDictionary[@"fullText"]; if ([self cellIsSelected:indexPath]) { cell.sequeBtn.hidden = NO; cell.pictureView.contentMode = UIViewContentModeScaleToFill; cell.descriptionLabel.numberOfLines = 7; } else { cell.sequeBtn.hidden = YES; cell.pictureView.contentMode = UIViewContentModeScaleAspectFill; cell.descriptionLabel.numberOfLines = 2; } [cell.descriptionLabel sizeToFit]; cell.pictureView.image = dataDictionary[@"image"]; return cell; } - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath { MainCell *mainCell = (MainCell *)cell; mainCell.descriptionLabel.originY = mainCell.sequeBtn.hidden ? heightCell - mainCell.descriptionLabel.height - 5 : mainCell.height - mainCell.sequeBtn.height - mainCell.descriptionLabel.height - 12; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload