简体   繁体   中英

Rotating app weird text skewing problem? Using shouldAutorotateToInterfaceOrientation

I am creating my first iPhone app which rotates when the user rotates the phone. I have a bit of a weird problem. I have a label with some text in it and when the screen rotates the text sort of deforms. Once in the new position it looks perfectly fine. Has anyone had this problem? I am just using the regular way of shouldAutorotateToInterfaceOrientation to enable rotation. I've been googling the problem but so far it seems to be just me :-O

Also is there a way of forcing the app to load the view in portrait to start with, then once loaded allowing rotation?

Thanks

It happens because the view's layer contents are drawn at the new size at the start of the animation. You can change behaviour to some extent by setting your view's contentMode (UIViewContentModeCenter might look okay, for example).

The alternative is reflowing/redrawing the text for each frame of the animation, which may be possible but is not going to perform very well.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM