Changing text alignment in UITableViewCell On Rotate

I am using size classes to turn two xib files (iPhone vs iPad) into one. Most orientations have a 2x2 grid of UILabels over the UITextView. However, for the iPhone portrait, I want the UILabels to stack vertically. It works great for me with classes. However, I was disappointed that the calibration classes do not allow changing the text alignment. See My charts below. In main orientation I have text in yellow and blue UILabels right aligned. In the portrait orientation of the iPhone, I want the same UILabels to have left-aligned text. How can I change this if the user rotates the device while viewing these table cells? I find this is better than reloading the table.

UITableViewCell Orientations


source to share

1 answer

I don't think it is possible to adjust text alignment based on screen or device orientation. however, you can create 2 shortcuts, one with left aligned text and one with whatever you otherwise use, so that they are exclusive to the screen you are using. That is, one shortcut for the iPhone and one shortcut for everything else.

You can choose for this UILabel in the storyboard which screen layouts will be set for.



All Articles