Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/115.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone WeeApp中的横向模式_Iphone_Ios_Objective C_Jailbreak - Fatal编程技术网

Iphone WeeApp中的横向模式

Iphone WeeApp中的横向模式,iphone,ios,objective-c,jailbreak,Iphone,Ios,Objective C,Jailbreak,我知道在iOS中有很多关于UIDeviceOrientation的问题已经解决了,但是没有人为我工作。我想在小部件中以横向模式为中心制作一个标签 [[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications]; if (([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft) || ([[UIDevice cur

我知道在iOS中有很多关于
UIDeviceOrientation
的问题已经解决了,但是没有人为我工作。我想在
小部件中以横向模式为中心制作一个标签

[[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)
}
因为某些原因,这对我不起作用


提前谢谢。

我今天刚刚为我的小部件解决了这个问题。定义方法

- (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;
}
您可以在我的文件中看到我的实现。我通过查看的代码找到了它