0
的UITableViewCell/UITableView的:在UITableViewCell中2個UILabels動態調整閃爍
我要在圖像中顯示一些像這樣的事情在兩個UILabels垂直旁邊基於文本的另一個擴大。
這就是我試圖做的。
對於label1,我使用NSMutableAttributedString,以便我可以設置行間距。 Label2與正常的字符串文本。 )的UITableView的
屬性
tableView.estimatedRowHeight = 110
tableView.rowHeight = UITableViewAutomaticDimension
heightForRowAtIndexPath(未實現爲這些屬性將採取高度的護理動態
在的cellForRowAtIndexPath()
var paragraphStyle = NSMutableParagraphStyle()
paragraphStyle.lineSpacing = 15
paragraphStyle.alignment = NSTextAlignment.Right
attrString = NSMutableAttributedString(string: "HUGE TEXT 1")
attrString.addAttribute(NSParagraphStyleAttributeName, value:paragraphStyle, range:NSMakeRange(0, attrString.length))
myCell.label1.attributedText = attrString
myCell.label2.text = "HUGE TEXT 2"
問題:當向下滾動(來自下方的新細胞)沒有問題,但是當我向上滾動時(新細胞從上向下),細胞開始閃爍,並且t母雞調整大小以適應卷軸的末尾。閃爍僅在UILabel2上。對於這種佈局,我似乎沒有發現堆棧溢出的解決方案。