设备旋转但屏幕无法拉伸 [英] device rotated but screen not stretches
问题描述
在我的iPhone应用程序中,我通过以下方法返回了yes,它的工作状态和屏幕旋转,但是在横向模式下内容不适合屏幕
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
以下是我使用的代码
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
return YES;
}
以下是我的输出
旋转屏幕时,如何使屏幕内容适合屏幕大小?有人可以帮助我吗,提前谢谢,
how can i fit the contents of the screen to the screen size when its rotated,,can any one help me, thanx in advance,,
推荐答案
当设备将要旋转时,应重置视图框架
.通常应在 willRotateToInterfaceOrientation
方法中完成此操作.
You should reset the views frame
when the device is about to be rotated. This should be usually done in willRotateToInterfaceOrientation
method.
您还可以简单地使用 autoResizingMask
,当其superView框架更改时,该视图会自动调整视图的大小.
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;
这篇关于设备旋转但屏幕无法拉伸的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!