I want to center the text vertically inside a big UITextView that fills the whole screen – so that when there’s little of text, say a couple of words, it is centered by height.
It’s not a question about centering the text (a property that can be found in IB) but about putting the text vertically right in the middle of UITextView if the text is short, so there are no blank areas in the UITextView.
Can this be done?
I want to center the text vertically inside a big UITextView that fills the
Share
First add an observer for the
contentSizekey value of theUITextViewwhen the view is loaded:Then add this method to adjust the
contentOffsetevery time thecontentSizevalue changes: