device rotated but screen not stretches

早过忘川 提交于 2019-12-12 02:04:20

问题


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)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
    {
         return YES;

    }

following is my output

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


回答1:


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;



回答2:


read this tutorial:

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

implementing willRotateToInterfaceOrientation will be solution



来源:https://stackoverflow.com/questions/7256785/device-rotated-but-screen-not-stretches

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!