Gib*_*son 5 uiwebview orientation screen-orientation orientation-changes ios
我有一个UIWebView我想加载不同的URL取决于它的肖像或风景.我如何弄清楚我目前的方向是viewWillAppear什么?
Sam*_*Sam 14
使用UIApplication的statusBarOrientation属性.如果您使用的设备的方向,如果它是你可能会遇到问题UIDeviceOrientationFaceUp或UIDeviceOrientationFaceDown.
例
UIInterfaceOrientation orientation = [UIApplication sharedApplication].statusBarOrientation;
if (UIInterfaceOrientationIsLandscape(orientation))
{
// Do something when in landscape
}
else
{
// Do something when in portrait
}
Run Code Online (Sandbox Code Playgroud)