I want to align text vertically center in UItextView
.
I am using following code
UITextView *tv = object;
CGFloat topCorrect = ([tv bounds].size.height - [tv contentSize].height * [tv zoomScale])/2.0;
topCorrect = ( topCorrect < 0.0 ? 0.0 : topCorrect );
tv.contentOffset = (CGPoint){.x = 0, .y = -topCorrect}
;
Somehow this doesn't work in iOS 5 as the contentSize returned there is different what I get in iOS6.
Any Idea why contentSize
of the same textView is different in iOS 5 and iOS 6?