UITextView ausrichten von text vertikal zentrieren

Ich soll ausrichten, text vertikal zentrieren in UItextView.

Ich bin mit dem folgenden 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}

;

Irgendwie das funktioniert nicht in iOS 5 als contentSize kehrte dort anders ist, was ich in iOS6.

Jede Idee, warum contentSize von der gleichen textView ist anders in iOS 5 und iOS 6?

Schreibe einen Kommentar