UI随设备旋转从iOS6到iOS8的适配策略

  • (void)statusBarOrientationChange:(NSNotification *)notification{
    WClassAndFunctionName;
    UIInterfaceOrientation oriention = [UIApplication sharedApplication].statusBarOrientation;
    [self adaptUIBaseOnOriention:oriention];
    }
  • (void)registerListeningDeviceOriention{
    [[NSNotificationCenter defaultCenter] addObserver:self mselector:@selector(statusBarOrientationChange:) name:UIApplicationDidChangeStatusBarOrientationNotificationobject:nil];
    }
  • (void)statusBarOrientationChange:(NSNotification *)notification
    {
    WClassAndFunctionName;
    UIInterfaceOrientation oriention = [UIApplication sharedApplication].statusBarOrientation
    [self adaptUIBaseOnOriention:oriention];//比如改变self.frame
    }

CGFloat windowWidth = kDeviceWindowWidth4Panel;
//iOS8不用更改
CGFloat windowHeight = kDeviceWindowHeight4Panel;
if (!IsIOS8orAbove) {
windowWidth = (!kIsDeviceLandscape) ? kDeviceWindowWidth4Panel:kDeviceWindowHeight;
windowHeight = (!kIsDeviceLandscape) ? kDeviceWindowHeight4Panel:(kDeviceWindowWidth - (IsIOS7orAbove ? 0 : kSystemStatusBarHeight));
}

你可能感兴趣的:(UI随设备旋转从iOS6到iOS8的适配策略)