0
위젯을 사용합니다. 애니메이션으로 셀 높이를 변경해야합니다. "더보기"를 클릭하면 추가 컨트롤로 이동하십시오. enter image description hereUITableView 셀 높이 애니메이션
는이 코드
tableView.beginUpdates()
showModes(alpha: 1, duration: 0.2, delay: 0.1)
tableView.endUpdates()
func showModes(alpha: CGFloat, duration: CGFloat, delay: CGFloat) {
if tableView.numberOfRows(inSection: 0) != 0 {
for i in 0...tableView.numberOfRows(inSection: 0)-1 {
let indexPath = IndexPath(row: i, section: 0)
if let cell = tableView.cellForRow(at: indexPath) as? WidgetCell {
UIView.animate(withDuration: TimeInterval(duration), delay: TimeInterval(delay) ,animations: {
if alpha == 0 {
cell.favoriteConstraint.constant = -45
} else {
cell.favoriteConstraint.constant = 10
}
cell.favoriteMode.alpha = alpha
self.tableView.layoutIfNeeded()
})
}
}
}
}
을 썼다 그러나이 원활하게 작동하지 않습니다. 그것은 극적으로 위아래로 트위스트. 예를 들어 Apple의 날씨 위젯과 같이이 기능을 원활하게 작동 시키려면 어떻게해야합니까?
예, 그것은 모두의 viewDidLoad() { super.viewDidLoad() ledControllers = readLED() self.tableView.estimatedRowHeight = 300 self.tableView.rowHeight = FUNC 재정의를 추가 UITableViewAutomaticDimension } 비디오를 명확하게 녹음했습니다. 첫 번째 셀이 확장되고 애니메이션 만 시작됩니다. 날씨 위젯과 비슷했으면 좋겠다. https://youtu.be/f4D7NnoyWrQ P. Судя по нику вы говорите по русски? – MacSergey