开发者

Aligning text in the center after rotation

开发者 https://www.devze.com 2023-03-30 04:57 出处:网络
I am rotating the view and resizing and moving around UIT开发者_高级运维extFields when this occurs. The only problem is that the placeholder text no longer stays in the middle. What should I do? Thank

I am rotating the view and resizing and moving around UIT开发者_高级运维extFields when this occurs. The only problem is that the placeholder text no longer stays in the middle. What should I do? Thanks!


This appears to be a bug with UIKit. This code was executed on rotation for both portrait and landscape:

textField.textAlignment = UITextAlignmentLeft; 
textField.textAlignment = UITextAlignmentCenter;

The text field's textAlignment property is moved to the left, then back to the center, almost refreshing it. If I try running the code without moving it to the left first, it doesn't work.

0

精彩评论

暂无评论...
验证码 换一张
取 消