ios - UILabel incorrectly sized in UITableViewCell (Animation after assigning text) -
the text in uilabel
flickering after being displayed, first appearing ellipsis on single line, occupying 2 lines fits in. notice cell height doesn't change.
here problem:
label "Друзъя, примите участие и наполните Коробку!" (friends, take part , fill boxes!) first appears truncated , misaligned "Друзъя, примите участи..." during view transition.
this happens on iphone 4s ios 8.1. manipulation label (except text assigning) happens in storyboard.
what causing flickering?
assuming changing test in cellforrowatindexpath
, , further assuming not happen strings, length, ios bug.
see lengthy discussion on this stack overflow uitableviewcell
post, , possible workaround:
override func viewdidload() { super.viewdidload() tableview.setneedslayout() tableview.layoutifneeded() tableview.reloaddata() }
notes
1. have noticed using small value estimatedrowheight
such 20
, not tall smallest cell, in combination doubled reloaddata()
beneficial.
2. need invoke reloaddata()
prior setneedslayout()
when changing cell width, such toggling tableview.editing
3. robust alternative tinkering label use non editable, non selectable, none capitalization, noscrolling enabled, no show horizontal & vertical indicator, no bounce uitextview
.
exercise bug, , try out various workarounds:
► find solution on github , additional details on swift recipes.
Comments
Post a Comment