views:

632

answers:

2

Hi, I have put my iPhone app in landscape mode and I want to put a message in one of my views that fills the screen. As of now a 6, 10 or 12 character message only goes up to about 12 point font in portrait view in interface builder. When I build and the iPhone simulator switches to landscape the font size stays the same as in portrait and doesn't fill the view.

Can anyone help?

A: 

I think you need to detect the rotation and resize your UIView's frame accordingly.. I'm not sure if you're using a label, webview, etc.. to display this text, but resizing the UIView and the item displaying the text should cause a smooth 'text-fill'

Dutchie432
I'm using a label. Do I need to write code to change the size once in landscape mode or should the adjust to fit check box in interface builder make it adjust in this prospective as well?
Buffernet
If you anchor the label to the width of the frame, it'll adjust automatically
Benny Wong
A: 

If you're using a UILabel for the text, you need to anchor your UILabel (or whatever you're using) to the left and the right side of the application frame in interface builder. Then you need to set the adjustsFontSizeToFitWidth to YES and I think you should be set.

UILabel doc

Benny Wong
In the viewdidload method of the view I did: label.adjustsFontSizeToFitWidth = YES; There is no change. Any other ideas?
Buffernet