需要橫屏模式下,在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;
}