在WeeApp中的横屏模式

需要横屏模式下,在widget中心做一个标签。

[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
if (([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft) ||
    ([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeRight))
{
     d = 516; //my var to change the Position (The Value is just a test)
}

不知道为什么没实现。

AppController定义这个方法:

- (void)willAnimateRotationToInterfaceOrientation:(int)arg1

然后检测方向:

if (UIInterfaceOrientationIsLandscape(arg1)) {
    // you're in landscape mode
    float screenWidth = [UIScreen mainScreen].bounds.size.height;
}
else {
    // you're in portrait mode
    float screenWidth = [UIScreen mainScreen].bounds.size.width;
}