WeeApp中的景观模式

时间:2013-02-25 13:29:24

标签: iphone ios objective-c jailbreak

我知道在iOS中有很多关于UIDeviceOrientation的问题,但没有人为我工作。我想在横向模式中居的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)
}

由于某些原因,这对我不起作用......

提前致谢。

1 个答案:

答案 0 :(得分:0)

我今天刚想到我的小部件。定义方法

- (void)willAnimateRotationToInterfaceOrientation:(int)arg1

用于AppController。在里面,检查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;
}

您可以在我的文件here中查看我的实现。我通过查看WeeFacebook的代码来解决这个问题。

相关问题