IPC UI 业务包

更新时间:2023-11-13 03:37:52下载pdf

本文介绍了智能摄像机(IPC)相关的业务包,不同的业务包有不同的功能,您可以根据自己的需求加载。

建议您整体接入 UI 业务包。如果只是调用 UI 业务包某个面板的入口,可能存在上下文逻辑不对称风险。

IPC 面板业务包

IPC 面板业务包 (ThingSmartCameraPanelBizBundle) 是基于 智能生活 App SDK 开发的一系列摄像机功能相关的面板 SDK。

功能说明

业务包主要包括以下功能:

  • 预览面板
  • 回放面板
  • 云存储面板
  • 消息中心面板
  • 相册面板
  • 设置面板

接入组件

  1. Podfile 文件中加入以下代码:

    source "https://github.com/tuya/tuya-pod-specs"
    source 'https://cdn.cocoapods.org/'
    platform :ios, '11.0'
    
    target 'your_target_name' do
        # 添加摄像机面板业务包
        pod 'ThingSmartCameraPanelBizBundle'
    end
    
  2. 然后在项目根目录下执行 pod update 命令,通过 CocoaPods 集成第三方库。CocoaPods 的使用请参考 CocoaPods Guides

  3. 在工程的 info.plist 文件中添加需要的权限声明。

    业务包中封装了一系列 RN(React Native)接口供面板调用,其中会涉及到部分苹果隐私权限的声明。

    • 如果接入的设备面板有使用图片相关的权限,例如 相册,则需要添加:
      NSPhotoLibraryAddUsageDescription
      
    • 如果接入的设备面板有使用到麦克风的权限,例如 摄像机对讲,则需要添加:
      NSMicrophoneUsageDescription
      

服务协议

业务包实现 ThingCameraProtocol 协议以提供服务。在 ThingModuleServices 组件中查看 ThingCameraProtocol.h 协议文件内容为:

#import <UIKit/UIKit.h>

@class ThingSmartDeviceModel;

@protocol ThingCameraProtocol <NSObject>

/**
 获取摄像机 Native 面板
 @param devId 摄像机设备的 devId
 @param uiName 摄像机设备的 uiName,不同的 uiName 对应不同版本的面板 为 deviceModel 里的 uiName 属性
 */
- (UIViewController *)viewControllerWithDeviceId:(NSString *)devId uiName:(NSString *)uiName;

@optional

/**
 跳转摄像机回放面板
 @param deviceModel 摄像机设备
 */
- (void)deviceGotoCameraNewPlayBackPanel:(ThingSmartDeviceModel *)deviceModel;

/**
 跳转摄像机云存储面板
 @param deviceModel 摄像机设备
 */
- (void)deviceGotoCameraCloudStoragePanel:(ThingSmartDeviceModel *)deviceModel;

/**
 跳转摄像机消息中心面板
 @param deviceModel 摄像机设备
 */
- (void)deviceGotoCameraMessageCenterPanel:(ThingSmartDeviceModel *)deviceModel;

/**
 跳转摄像机相册面板
 @param deviceModel 摄像机设备
 */
- (void)deviceGotoPhotoLibrary:(ThingSmartDeviceModel *)deviceModel;

@end

依赖服务

业务包主要会依赖如下几个协议:ThingSmartHomeDataProtocolThingOTAGeneralProtocol

  • ThingSmartHomeDataProtocol:提供加载设备面板所需的当前家庭信息,为 必须实现 的协议。

    /**
    获取当前的家庭,当前没有家庭的时候,返回 nil。
    
    @return ThingSmartHome
    */
    - (ThingSmartHome *)getCurrentHome;
    
  • ThingOTAGeneralProtocol:进入设备面板时,提供检查设备固件更新的事件。实现如下方法用于检查固件升级:

    /**
    检查设备固件更新,如果有更新会显示展示出固件更新提示
    
    @param deviceModel 需要检查固件升级的设备
    @param isManual 是否手动检测升级
    @param theme 主题色
    YES: 手动检测升级,检测时弹出 loading 框。当有固件新版本时(检测升级、强制升级、提醒升级),显示 OTA VC。
    NO: 自动检测升级,检测时不弹出 loading 框。当有强制升级时、提醒升级时,弹出固件升级提示,点确定后显示 OTA VC。
    */
    - (void)checkFirmwareUpgrade:(ThingSmartDeviceModel *)deviceModel isManual:(BOOL)isManual theme:(ThingOTAControllerTheme)theme;
    

注意事项

  • 使用任何接口之前,务必确认该设备在当前用户下。
  • 此接口,只适用于摄像机设备调用,即 deviceModel.categorysp 类型的设备。
  • 调用业务包逻辑前,要先实现 ThingSmartHomeDataProtocol 中的协议方法getCurrentHome
  • 此业务包,与之前的 TuyaSmartCameraPanelSDK 互斥,二者不能共存。迁移之前,请参考 业务包迁移

Objective-C

#import <ThingSmartBizCore/ThingSmartBizCore.h>
#import <ThingModuleServices/ThingSmartHomeDataProtocol.h>

- (void)initCurrentHome {
    // 注册要实现的协议
    [[ThingSmartBizCore sharedInstance] registerService:@protocol(ThingSmartHomeDataProtocol) withInstance:self];
}

// 实现对应的协议方法
- (ThingSmartHome *)getCurrentHome {
    ThingSmartHome *home = [ThingSmartHome homeWithHomeId:@"当前家庭 id"];
    return home;
}

Swift

import ThingSmartDeviceKit

class ThingActivatorTest: NSObject,ThingSmartHomeDataProtocol{

    func test() {
        ThingSmartBizCore.sharedInstance().registerService(ThingSmartHomeDataProtocol.self, withInstance: self)
    }

    func getCurrentHome() -> ThingSmartHome! {
        let home = ThingSmartHome.init(homeId: 111)
        return home
    }

}

查看预览面板 (UIViewController)

摄像机原生预览面板包括视频实时预览、切换清晰度、控制声音开关、截图、录制、对讲、移动侦测、PTZ 方向控制、添加或删除收藏点、巡航控制等功能。

Objective-C

id<ThingCameraProtocol> impl = [[ThingSmartBizCore sharedInstance] serviceOfProtocol:@protocol(ThingCameraProtocol)];
UIViewController *vc = [impl viewControllerWithDeviceId:self.deviceModel.devId uiName:self.device.uiName];
[self.navigationController pushViewController:vc animated:YES];

Swift

let impl = ThingSmartBizCore.sharedInstance().service(of: ThingCameraProtocol.self) as? ThingCameraProtocol
impl?.viewControllerWithDeviceId(withDeviceId: deviceModel.devId!, uiName: deviceModel.uiName)

IPC RN 面板业务包

IPC RN 业务包(ThingSmartCameraRNPanelBizBundle)是基于 智能生活 App SDK 开发的一系列摄像机功能相关的 RN(React Native)面板业务包。

使用 IPC RN 面板业务包前,您需要集成设备控制 UI 业务包,详情请参考 设备控制 UI 业务包

功能说明

业务包主要包括以下功能:

  • 预览面板
  • 回放面板
  • 云存储面板
  • 消息中心面板
  • 相册面板
  • 设置面板

接入组件

  1. Podfile 文件中加入以下代码:

    source "https://github.com/tuya/tuya-pod-specs.git"
    source 'https://cdn.cocoapods.org/'
    
    target 'your_target_name' do
        # 添加面板控制业务包。
        pod 'ThingSmartPanelBizBundle'
        # 添加摄像机面板业务包,接入 RN 页面业务包的同时,也接入该业务包,使得原生相册等功能也可以正常使用。
        pod 'ThingSmartCameraPanelBizBundle'
        # 添加摄像机 RN 面板业务包。
        pod 'ThingSmartCameraRNPanelBizBundle'
    end
    
  2. 然后在项目根目录下执行 pod update 命令,通过 CocoaPods 集成第三方库。CocoaPods 的使用请参考 CocoaPods Guides

  3. 在工程的 info.plist 文件中添加需要的权限声明。

    业务包中封装了一系列 RN 接口供面板调用,其中会涉及到部分苹果隐私权限的声明。

    • 如果接入的设备面板有使用图片相关的权限,例如 相册,则需要添加:
      NSPhotoLibraryAddUsageDescription
      
    • 如果接入的设备面板有使用到麦克风的权限,例如 摄像机对讲,则需要添加:
      NSMicrophoneUsageDescription
      

使用说明

业务包实现 ThingPanelProtocol 协议以提供服务。在 ThingModuleServices 组件中 ThingPanelProtocol.h 协议文件内容包括:

#import <UIKit/UIKit.h>

@protocol ThingPanelProtocol <NSObject>

/**
 * 获取设备面板控制器
 * @param deviceModel 设备模型
 * @param initialProps 自定义初始化参数,会以 'extraInfo' 为 key 设置进 RN 应用的 initialProps 中
 * @param contextProps 自定义面板上下文,会以 'extraInfo' 为 key 设置进 Panel Context 中
 * @param completionHandler 回调返回视图控制器
 */
- (void)getPanelViewControllerWithDeviceModel:(ThingSmartDeviceModel *)deviceModel
                                 initialProps:(nullable NSDictionary *)initialProps
                                 contextProps:(nullable NSDictionary *)contextProps
                            completionHandler:(void (^ _Nullable)(__kindof UIViewController * _Nullable panelViewController, NSError * _Nullable error))completionHandler;

@end

依赖服务

业务包主要会依赖如下几个协议:ThingSmartHomeDataProtocolThingOTAGeneralProtocol

  • ThingSmartHomeDataProtocol:提供加载设备面板所需的当前家庭信息,为 必须实现 的协议。

    /**
    获取当前的家庭,当前没有家庭的时候,返回 nil。
    
    @return ThingSmartHome
    */
    - (ThingSmartHome *)getCurrentHome;
    
  • ThingOTAGeneralProtocol:进入设备面板时,提供检查设备固件更新的事件。实现如下方法用于检查固件升级:

    /**
    检查设备固件更新,如果有更新会显示展示出固件更新提示
    
    @param deviceModel 需要检查固件升级的设备
    @param isManual 是否手动检测升级
    @param theme 主题色
    YES: 手动检测升级,检测时弹出 loading 框。当有固件新版本时(检测升级、强制升级、提醒升级),显示 OTA VC。
    NO: 自动检测升级,检测时不弹出 loading 框。当有强制升级时、提醒升级时,弹出固件升级提示,点确定后显示 OTA VC。
    */
    - (void)checkFirmwareUpgrade:(ThingSmartDeviceModel *)deviceModel isManual:(BOOL)isManual theme:(ThingOTAControllerTheme)theme;
    

注意事项

  • 使用任何接口之前,务必确认该设备在当前用户下。
  • 此接口,只适用于摄像机设备调用,即 deviceModel.categorysp 类型的设备。
  • 调用业务包逻辑前,要先实现 ThingSmartHomeDataProtocol 中的协议方法getCurrentHome
  • 接入此业务包后,必须同时也接入 ThingSmartCameraPanelBizBundle 业务包。因为例如摄像机相册面板等的相关功能代码在 ThingSmartCameraPanelBizBundle 业务包中。

Objective-C

#import <ThingSmartBizCore/ThingSmartBizCore.h>
#import <ThingModuleServices/ThingSmartHomeDataProtocol.h>

- (void)initCurrentHome {
    // 注册要实现的协议
    [[ThingSmartBizCore sharedInstance] registerService:@protocol(ThingSmartHomeDataProtocol) withInstance:self];
}

// 实现对应的协议方法
- (ThingSmartHome *)getCurrentHome {
    ThingSmartHome *home = [ThingSmartHome homeWithHomeId:@"当前家庭 id"];
    return home;
}

Swift

import ThingSmartDeviceKit

class ThingActivatorTest: NSObject,ThingSmartHomeDataProtocol{

    func test() {
        ThingSmartBizCore.sharedInstance().registerService(ThingSmartHomeDataProtocol.self, withInstance: self)
    }

    func getCurrentHome() -> ThingSmartHome! {
        let home = ThingSmartHome.init(homeId: 111)
        return home
    }

}

查看预览面板(UIViewController)

摄像机 RN 预览面板包括视频实时预览、切换清晰度、控制声音开关、截图、录制、对讲等功能。

Objective-C

id<ThingPanelProtocol> impl = [[ThingSmartBizCore sharedInstance] serviceOfProtocol:@protocol(ThingPanelProtocol)];
// 获取面板视图控制器,自行跳转
if (deviceModel) {
    [impl getPanelViewControllerWithDeviceModel:deviceModel initialProps:nil contextProps:nil completionHandler:^(__kindof UIViewController * _Nullable panelViewController, NSError * _Nullable error) {
    }];
}

Swift

let impl = ThingSmartBizCore.sharedInstance().service(of: ThingPanelProtocol.self) as? ThingPanelProtocol
// 获取面板视图控制器,自行跳转
impl?.getPanelViewController(with: deviceModel, initialProps: nil, contextProps: nil, completionHandler: { (vc, err) in

})

IPC 设置面板业务包

IPC 设置面板业务包(ThingSmartCameraSettingBizBundle)是基于 智能生活 App SDK 开发的一系列摄像机常用设置等相关的面板。

功能说明

业务包主要包括以下功能:

  • 设备详情
  • 基础设置
  • 存储卡设置
  • 增值服务
  • 其他例如重启等

接入组件

  1. Podfile 文件中加入以下代码:

    source "https://github.com/tuya/tuya-pod-specs.git"
    source 'https://cdn.cocoapods.org/'
    
    target 'your_target_name' do
        # 添加摄像机设置面板业务包
        pod 'ThingSmartCameraSettingBizBundle'
    end
    
  2. 然后在项目根目录下执行 pod update 命令,通过 CocoaPods 集成第三方库。CocoaPods 的使用请参考 CocoaPods Guides

服务协议

摄像机设置业务包实现 ThingCameraSettingProtocol 协议以提供服务。在 ThingModuleServices 组件中查看 ThingCameraSettingProtocol.h 协议文件内容为:

#import <UIKit/UIKit.h>
@protocol ThingCameraSettingProtocol <NSObject>

/**
 Generate settingViewController
 获取摄像机设置面板
 @param params 摄像机设置页面相关的参数(例如:设置首页为 @{@"devId" : 设备 devID, @"cameraSettingPanelIdentifier" : @"cameraSettingIndexIdentifier"} )
 */
- (UIViewController *)settingViewControllerWithDeviceParams:(NSDictionary *)params;

/**
 Generate config item
 生成自定义配置
 @param tag see developer doc identifiers.
 @param visible whether is visible or not
 @param callBack you can custom jump action
 */
- (id)generateSettingCustomModelWithTag:(NSString *)tag visible:(BOOL)visible callBack:(void(^_Nullable)(void))callBack;

/**
 Config custom setting action and display
 配置设置项是否可见及设置项跳转
 @param items custom items, generated by generateSettingCustomModelWithTag:visible:callBack:
 */
- (void)configCustomItemWithItems:(NSArray<id>*)items;

@end

注意事项

  • 使用任何接口之前,务必确认该设备在当前用户下。
  • 此业务包,只适用于摄像机设备调用,即 deviceModel.categorysp 类型的设备。
  • 接入此业务包后,默认已经实现摄像机设置相关功能。

设置页面配置(ThingCameraSettingProtocol)

支持自定义配置设置页面上每项功能的显示、隐藏、单击事件拦截,相关接口定义在 ThingCameraSettingProtocol 中。

接口说明

/**
 Generate config item
 生成自定义配置
 @param tag see developer doc identifiers.
 @param visible whether is visible or not
 @param callBack you can custom jump action
 */
- (id)generateSettingCustomModelWithTag:(NSString *)tag visible:(BOOL)visible callBack:(void(^_Nullable)(void))callBack;

参数说明

参数 说明
visible 是否显示。
  • YES:显示
  • NO:隐藏
callBack 单击事件拦截的回调,可自定义跳转事件
tag 功能项的标识符,取值见下文表格

tag 名称说明

tag 名称 功能
cameraSetting_iconInfoItem 设备图标、名称等信息
cameraSetting_infoItem 设备信息
cameraSetting_autoItem 一键执行和自动化
cameraSetting_networkItem 设备网络信息
cameraSetting_thirdPartyItem 支持的第三方服务
cameraSetting_privateModeCfgItem 隐私模式开关
cameraSetting_basicSectionHeaderCfgItem 基础设置标题
cameraSetting_basicFuncCfgItem 基础设置
cameraSetting_nightvisionCfgItem 夜视模式
cameraSetting_irNightCfgItem 红外夜视功能
cameraSetting_displaySettingCfgItem 画面调节
cameraSetting_soundCfgItem 声音调节
cameraSetting_workModeCfgItem 工作模式
cameraSetting_advanceSectionHeaderCfgItem 高级设置标题
cameraSetting_detectCfgItem 侦测报警
cameraSetting_pirFuncCfgItem PIR
cameraSetting_powerCfgItem 电源管理
cameraSetting_bellCfgItem 铃铛设置
cameraSetting_sirenSettingCfgItem 蜂鸣器调节
cameraSetting_videoLayoutCfgItem 视频布局
cameraSetting_presentPointCfgItem 预设点设置
cameraSetting_onvifCfgItem ONVIF(Open Network Video Interface Forum)
cameraSetting_gatewaySectionHeaderCfgItem 网关标题
cameraSetting_gatewayCfgItem 网关
cameraSetting_storageSectionHeaderCfgItem 存储设置标题
cameraSetting_storageCfgItem 存储设置
cameraSetting_valueAddedSectionHeaderCfgItem 增值服务标题
cameraSetting_valueAddedCfgItem 增值服务
cameraSetting_offlineSectionHeaderCfgItem 离线提醒标题
cameraSetting_offlineCfgItem 离线提醒
cameraSetting_otherSectionHeaderCfgItem 其他标题
cameraSetting_feedbackCfgItem 常见问题与反馈
cameraSetting_firmwareCfgItem 设备升级
cameraSetting_restartCfgItem 重启设备
cameraSetting_removeCfgItem 移除设备
cameraSetting_indicatorLightItem 状态指示灯
cameraSetting_besharedItem 设备来自
cameraSetting_soundDetectedItem 声音检测
cameraSetting_apModeItem 热点模式
cameraSetting_unlockItem 远程解锁
cameraSetting_cloudDisk 基站云盘页面
cameraSetting_privacyZone 隐私区域设置
cameraSetting_recording_time 单段录影时间设置
cameraSetting_parking_mode 停车模式设置
cameraSetting_collision_alert 碰撞报警
cameraSetting_antiDismantle 防拆告警开关
cameraSetting_notification 消息推送设置
cameraSetting_carInspection 车型检测开关
cameraSetting_nonCarInspection 非机动检测开关
cameraSetting_thirdPartyHeaderItem 支持的第三方标题
cameraSetting_pirSetItem PIR 设置
cameraSetting_stationDoorbellItem 基站门铃设置
cameraSetting_stationDetectionItem 基站侦测报警

接口说明

/**
 Config custom setting action and display
 配置设置项是否可见及设置项跳转
 @param items custom items, generated by generateSettingCustomModelWithTag:visible:callBack:
 */
- (void)configCustomItemWithItems:(NSArray<id>*)items;

参数说明

参数 说明
items 传入数组,数组中的 itemgenerateSettingCustomModelWithTag:visible:callBack: 生成

Objective-C

id <ThingCameraSettingProtocol> cameraSettingProtocol = [[ThingSmartBizCore sharedInstance] serviceOfProtocol:@protocol(ThingCameraSettingProtocol)];

id item1 = [cameraSettingProtocol generateSettingCustomModelWithTag:@"cameraSetting_infoItem" visible:NO callBack:nil];
id item2 = [cameraSettingProtocol generateSettingCustomModelWithTag:@"cameraSetting_networkItem" visible:NO callBack:nil];

[cameraSettingProtocol configCustomItemWithItems:@[item1, item2]];

Swift

let cameraSettingProtocolImpl = ThingSmartBizCore.sharedInstance().service(of: ThingCameraSettingProtocol.self) as? ThingCameraSettingProtocol
if let impl = cameraSettingProtocolImpl {
    let item1 = impl.generateSettingCustomModel(withTag: "cameraSetting_infoItem", visible: false, callBack: nil)
    let item2 = impl.generateSettingCustomModel(withTag: "cameraSetting_networkItem", visible: false, callBack: nil)
    impl.configCustomItem(withItems: [item1!, item2!])
}

适配 iOS 16 全屏预览

iOS 16 版本系统在 UIKit 上有了一些更改,例如横竖屏旋转的方法不会向前兼容。

涂鸦 IPC 业务包已经兼容了 iOS 16 版本的横竖屏特性。如果您在升级涂鸦 IPC 业务包后,在切换横屏时仍然会显示错乱,有可能是您在 App 适配 iOS 16 时,和 IPC 业务包的适配方案不兼容。建议您的 App 按照以下流程适配适配 iOS 16 横屏:

  • 场景一:除了涂鸦 IPC 业务包的页面外,您的 App 只提供了竖屏播放。此时,建议您按照下面流程进行适配:

    1. AppDelegate.m 类新增以下方法,用来确保 App 支持所有旋转方向:

      - (UIInterfaceOrientationMask)application:(UIApplication *)application
      supportedInterfaceOrientationsForWindow:(UIWindow *)window {
          return UIInterfaceOrientationMaskAll;
      }
      
    2. 新增 UIViewController Category 类别,UIViewController+Category 并新增以下方法,用来确保所有页面只兼容竖屏情况:

      -(BOOL)shouldAutorotate {
          return NO;
      }
      
      -(UIInterfaceOrientationMask)supportedInterfaceOrientations {
          return UIInterfaceOrientationMaskPortrait;
      }
      
      -(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
          return UIInterfaceOrientationPortrait;
      }
      
    3. 新增 UINavigationController Category 类别,UINavigationController+Category 并添加下面方法,用来确保您的 App 能够正确兼容 IPC 业务包关于 iOS16 横竖的适配:

      -(BOOL)shouldAutorotate {
          return [self.topViewController shouldAutorotate];
      }
      
      -(UIInterfaceOrientationMask)supportedInterfaceOrientations {
          return [self.topViewController supportedInterfaceOrientations];
      }
      
      -(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
          return [self.topViewController preferredInterfaceOrientationForPresentation];
      }
      
  • 场景二:除了涂鸦 IPC 业务包的页面外,您的 App 也提供了横屏播放。此时,建议您按照下面流程进行适配:

    1. AppDelegate.m 类新增以下方法,用来确保 App 支持所有旋转方向:

      - (UIInterfaceOrientationMask)application:(UIApplication *)application supportedInterfaceOrientationsForWindow:(UIWindow *)window {
          return UIInterfaceOrientationMaskAll;
      }
      
    2. 新增 UINavigationController Category 类别,UINavigationController+Category 并添加下面方法,用来确保您的 App 能够正确兼容 IPC 业务包关于 iOS16 横竖的适配:

      -(BOOL)shouldAutorotate {
          return [self.topViewController shouldAutorotate];
      }
      
      -(UIInterfaceOrientationMask)supportedInterfaceOrientations {
          return [self.topViewController supportedInterfaceOrientations];
      }
      
      -(UIInterfaceOrientation)preferredInterfaceOrientationForPresentation {
          return [self.topViewController preferredInterfaceOrientationForPresentation];
      }
      
    3. 在您业务中,只支持竖屏的页面添加以下方法,如果您有统一的 BaseViewController,则在父类中添加以下方法即可:

      不能直接以 Category 的形式添加。如果没有统一的基类,则所有只支持竖屏的 viewController 类都要添加。

      - (BOOL)shouldAutorotate {
          return NO;
      }
      
      - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
          return UIInterfaceOrientationMaskPortrait;
      }
      
    4. 在支持横屏业务的页面,新增以下内容:

      新增 UIViewController 的私有类别 UIViewController+privete,并声明 - (void)thing_rotateWindowIfNeed; 方法。

      该方法您不需要实现,只要声明即可,实现是由业务包组件实现。

      @interface UIViewController (privete)
      
      - (void)thing_rotateWindowIfNeed;
      
      @end
      
    5. 在您支持横屏的业务的页面控制器 A 中,新增全局变量:

      @property (nonatomic, assign) BOOL fullScreen;
      
    6. 并在 A 类中新增以下方法:

      - (BOOL)shouldAutorotate {
          return YES;
      }
      
      - (UIInterfaceOrientationMask)supportedInterfaceOrientations {
          if (self.fullScreen) {
              return UIInterfaceOrientationMaskLandscapeRight;
          }
          return UIInterfaceOrientationMaskPortrait;
      }
      
    7. 进入 A 页面时,您可能有两种业务场景:

      • 场景一,进入 A 页面时就横屏展示。此时,在页面控制器 A 的 -(void)viewDidload; 方法中,将变量 fullScreen 置为 YES,并调用 [self thing_rotateWindowIfNeed]; 即可。

      • 场景二,A 页面有个按钮,单击按钮后横屏展示。此时,您需要在在按钮的响应方法加入以下代码:

        - (void)fullScreenAction {
            self.fullScreen = !self.fullScreen;
            [self thing_rotateWindowIfNeed];
        }