setOrientation in UIDevice is depreciate for iOS 5 and upper version. If we want to change or limit the orientation of current view controller. We still need to set the device orientation. In fact we still get 3 ways to handle it:
if ([[UIDevice currentDevice] respondsToSelector:@selector(setOrientation:)]) { SEL selector = NSSelectorFromString(@"setOrientation:"); NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[UIDevice instanceMethodSignatureForSelector:selector]]; [invocation setSelector:selector]; [invocation setTarget:[UIDevice currentDevice]]; int val = UIInterfaceOrientationLandscapeRight; [invocation setArgument:&val atIndex:2]; [invocation invoke]; }
2nd:
objc_msgSend([UIDevice currentDevice], @selector(setOrientation:), UIInterfaceOrientationLandscapeLeft);
3rd:
UIViewController *controller = [[UIViewController alloc] init]; [self presentViewController:controller animated:NO completion:nil]; [self dismissViewControllerAnimated:NO completion:nil];
The first 2 method may have a risk to be rejected. I'm afraid Apple may think it a private API. The 3rd method, ok, I agree it's not a beautiful solution.
//************************************************************************************
DebugLog(@"%d,%d,%d,%d\n%d,%d,%d,%d",UIInterfaceOrientationPortrait,UIInterfaceOrientationPortraitUpsideDown,UIInterfaceOrientationLandscapeRight,UIInterfaceOrientationLandscapeLeft,UIInterfaceOrientationMaskPortrait,UIInterfaceOrientationMaskPortraitUpsideDown ,UIInterfaceOrientationMaskLandscapeRight, UIInterfaceOrientationMaskLandscapeLeft);
1,2,3,4
2,4,6,8
相关推荐
82. **SET_ORIENTATION**:应用可以更改设备的屏幕方向。 83. **SET_PREFERRED_APPLICATIONS**:应用可以设置默认应用。 84. **SET_PROCESS_FOREGROUND**:应用可以将自己置于前台,提高优先级。 85. **SET_TIME*...
R:\wyb\gc2145_parrotv1.1_r16m\lichee\linux-3.4\drivers\media\video\sunxi-vfe\device\gc2145.c 搜索:_regs[] static struct regval_list sensor_default_regs[] = { (默认分辨率是VGA分辨率:640x480) /* ...
5. **绑定事件监听器**:在窗口的`resize`和`deviceorientation`事件上添加监听器,以便适当地调整渲染和处理设备运动数据。 6. **更新控制器**:在每一帧的渲染循环中调用`DeviceOrientationControls.update()`,以...
Orientation(方向):** 报告描述符中的项可能具有特定的方向性,这有助于区分输入项和输出项。 **10. Null Values(空值):** 某些情况下,报告描述符中可能会包含空值,这些值通常用于表示无效或未使用的数据...
-synchronize synchronize image to storage device -taint declare the image as modified -texture filename name of texture to tile onto the image background -tile-offset geometry tile offset -...
31. `android.permission.SET_ORIENTATION`:允许程序改变屏幕方向,通常由系统自动处理。 32. 更多未列出的权限也有类似的功能,如改变系统状态、读取或写入特定系统数据等。 这些权限的使用应当谨慎,尤其是涉及...
横向的 css 样式 */}`、 `@media screen and (orientation: portrait){/* 横向的 css 样式 */}` 等媒体查询。 本文详细介绍了如何在 Windows Server 2008 R2 中使用 WEB 修改域用户密码,并简要介绍了基于 WebKit ...
The interface defines a standard orientation for reporting device native coordinates. When the user is viewing the device in its normal position, the coordinate origin will be at the lower left of the...
android:orientation="vertical" android:layout_width="fill_parent" android:layout_height="fill_parent" android:background="#808080"> android:id="@+id/slidingdrawer" android:layout_width="fill_...
only for facing back camera in android2.3, should be set in android4.0 used_zoom = 1 key_zoom_supported = true key_smooth_zoom_supported = false key_zoom_ratios = 100,120,150,200,230,250,300 key_max_...
vip_define_sensor_list: If you want use sensor detect function, please set vip_define_sensor_list = 1, and ; verify that file /system/etc/hawkview/sensor_list_cfg.ini is properly configured! ; ;vip_...
only for facing back camera in android2.3, should be set in android4.0 used_zoom = 1 key_zoom_supported = true key_smooth_zoom_supported = false key_zoom_ratios = 100,120,150,200,230,250,300 key_max_...
only for facing back camera in android2.3, should be set in android4.0 used_zoom = 1 key_zoom_supported = true key_smooth_zoom_supported = false key_zoom_ratios = 100,120,150,200,230,250,300 key_max_...
vip_define_sensor_list: If you want use sensor detect function, please set vip_define_sensor_list = 1, and ; verify that file /system/etc/hawkview/sensor_list_cfg.ini is properly configured! ; ;vip_...
vip_define_sensor_list: If you want use sensor detect function, please set vip_define_sensor_list = 1, and ; verify that file /system/etc/hawkview/sensor_list_cfg.ini is properly configured! ; ;vip_...
vip_define_sensor_list: If you want use sensor detect function, please set vip_define_sensor_list = 1, and ; verify that file /system/etc/hawkview/sensor_list_cfg.ini is properly configured! ; ;vip_...
vip_define_sensor_list: If you want use sensor detect function, please set vip_define_sensor_list = 1, and ; verify that file /system/etc/hawkview/sensor_list_cfg.ini is properly configured! ; ;vip_...