问题
I have some static Label with static text that will not change forever.
I adjust the layout in Interface Builder until they look great. and use Cmd + = to let all label's size fit their contents.
But when I run and test them on emulator and device they become truncate even though they look fit in the Interface Builder.
I have test it on iOS 5.0, 6.1 and on 3.5, 4 inches include on iphone5 device. All the result are different from in Interface Builder.
Emulator

Interface Builder

Any help to overcome this?
Thanks
回答1:
You can try using this code for fitting the label content.
For that you need to have a IBOutlet for the label and then after that,
use this code when you load the view :
[self.label sizeToFit];
Hope that works !
回答2:
As there's a change in DateFormatter it's creating a problem. In your XIB, date is in different format than your device.
You can set Minimum Font Size for your label from your XIB. Check below screenshot.

I hope it'll solve your problem.
Thanks,
Hemang.
来源:https://stackoverflow.com/questions/16828737/uilabel-doesnt-show-text-properly-in-emulator-and-real-device-as-it-does-in-int