开发者

device rotated but screen not stretches

in my iphone app i have returned yes in the following method ,its worked and screens are rotating but contents are not fitting to the screen when its in the landscape mode

following is the code which i used

  - (BOOL)shouldAutorotateTo开发者_运维百科InterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
         return YES;

    }

following is my output

device rotated but screen not stretches

how can i fit the contents of the screen to the screen size when its rotated,,can any one help me, thanx in advance,,


You should reset the views frame when the device is about to be rotated. This should be usually done in willRotateToInterfaceOrientation method.

You can also simply use autoResizingMask which will automatically resize the view when its superView frame changes.

// Add this line in loadView method
self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | 
                             UIViewAutoresizingFlexibleHeight;


read this tutorial:

http://www.shinstudio.com/blog/programming/rotating-view-in-iphone-app/

implementing willRotateToInterfaceOrientation will be solution

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜