Last active
March 15, 2018 06:19
-
-
Save 5minho/82a9a1165f8c557a283004bb208f9f94 to your computer and use it in GitHub Desktop.
text 에 따라서 UITextView 의 height를 변경
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension ViewController : UITextViewDelegate { | |
func textViewDidChange(_ textView: UITextView) { | |
let expendSize = CGSize(width: textView.frame.width, height : .infinity) | |
let estimatedSize = textView.sizeThatFits(expendSize) | |
let heightOffset = estimatedSize.height - CGFloat(37.verticalValueAppliedScreenSize) | |
self.ratingInputView.snp.updateConstraints { (make) in | |
make.height.equalTo(heightOffset + CGFloat(95.verticalValueAppliedScreenSize)) | |
} | |
UIView.animate(withDuration: 0.2) { | |
self.view.layoutIfNeeded() | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment