func textViewContentHeightChange(textView: UITextView) {
DispatchQueue.main.async {
if textView.bounds.size.height > textView.contentSize.height {
var topDeviation = (textView.bounds.size.height - textView.contentSize.height)
topDeviation = topDeviation < 0 ? 0 : topDeviation
textView.contentOffset = CGPoint(x: 0, y: -topDeviation/2)
}
}
}
让textView文字垂直居中
猜你喜欢
转载自my.oschina.net/wayzhu/blog/1813999
今日推荐
周排行