The RubyMotion layout and styling gem. Follow @MotionKit on twitter for updates and commit notifications
heightForRowAtIndexPath
?
def heightForText(attributedText, tableWidth)
minHeight = 30.0
textWidth = tableWidth - (Size.margins.left + Size.margins.right + Size.textMargins.left + Size.textMargins.right)
tv = generateTextView()
tv.attributedText = attributedText
tvSize = tv.sizeThatFits(CGSize.new(textWidth, _000_000))
heightPadding = Size.margins.top + Size.margins.bottom + Size.textMargins.top + Size.textMargins.bottom
textHeight = heightPadding + tvSize.height.round()
return [minHeight, textHeight].max
end
string.empty?
In RM