Я пытаюсь изменить размер метки при выборе моей настраиваемой ячейки (чтобы она расширялась, чтобы было видно больше текста).Изменение высоты метки пользовательской ячейки внутри didSelectRowAtIndexPath
Я, очевидно, пропустил что-то фундаментальное, потому что рамка точно такая же, как только я попытаюсь нарисовать новый CGRect.
Вот соответствующий код:
func tableView(tableView: UITableView, didSelectRowAtIndexPath indexPath: NSIndexPath) {
let indexPath = tableView.indexPathForSelectedRow()
let currentCell = tableView.cellForRowAtIndexPath(indexPath!) as! BasicCell
UIView.animateWithDuration(0.3) {
tableView.beginUpdates()
currentCell.subtitleLabel!.frame = CGRectMake(currentCell.subtitleLabel!.frame.origin.x, currentCell.subtitleLabel!.frame.origin.y, currentCell.subtitleLabel!.frame.size.width, 100)
currentCell.subtitleLabel!.numberOfLines = 0
tableView.endUpdates()
}
}
Любая помощь будет оценена.
Попробуйте добавить Bool к пользовательской ячейке и в методе heightForRowAtIndexPath установить высоту ячейки contentSize.height иначе tableView.rowHeight –