ios - UIlabel shows extra space before text -
I have used UILB in my app, it is working properly in portrait mode, but when I use my landscape in landscape mode If I open the app then it shows content in the center of UILabel. I've tried the size, but it is not working. As soon as I increase the width of the womb, the more I begin to come to Urabel.
My code:
self.contentLabel.text = labeltext; [Self content label setNumberOffline: 0]; [Self. Content label size tofitt];
I doubt your UILB and the text inside it is actually wrong form on rotation Is not aligned with. Make sure the label stays at the top of the view. Try:
self.contentLabel.autoresizingMask = UIViewAutoresizingFlexibleHighight;
or
self-latin Labeling Mask = UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
Edit: Another thought.
If the automatic layout is enabled and you are calling
size tofitt
inviewDidLoad
, the size of the view is changing after the automatic layout, Shows SubViews Try putting your code instead