ipu的trunk版ios客户端工程

ViewController.m 3.6KB

    // // ViewController.m // display-center // // Created by tony on 17/5/18. // Copyright © 2017年 shelomi. All rights reserved. // #import "ViewController.h" #import <React/RCTRootView.h> #import <React/RCTBridge.h> #import <IpuRNKit/IpuRNManager.h> #import <WadeMobile/IPUDragButton.h> #import <IpuRNKit/IpuRNViewControllerUtil.h> #import <IpuRNKit/IpuRNBaseViewController.h> #import <WadeMobile/WDTemplateNavigateController.h> #define ButtonWH 40 #define Padding 5 #define ScreenWidth CGRectGetWidth([UIScreen mainScreen].bounds) #define ScreenHeight CGRectGetHeight([UIScreen mainScreen].bounds) @interface ViewController () @property(nonatomic,strong)IPUDragButton *dragButton; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; self.dragButton = [[IPUDragButton alloc] initWithFrame:CGRectMake(ScreenWidth-Padding-ButtonWH, ScreenHeight-3*ButtonWH, ButtonWH, ButtonWH)]; [self.dragButton addTarget:self action:@selector(back) forControlEvents:UIControlEventTouchUpInside]; [self.view addSubview:self.dragButton]; // [IpuRNManager updateRNResource]; } /* 悬浮按钮返回事件 */ - (void)back { UIViewController *viewController = [IpuRNViewControllerUtil getCurrentViewController]; if ([viewController isKindOfClass:[WDViewController class]]) { WDViewController *wdViewController = (WDViewController *)viewController; UIView *webView = [wdViewController getCurrentWebView]; if ([webView performSelector:@selector(canGoBack)]) { [webView performSelector:@selector(goBack)]; } else { WDFlipperView *flipperView = [wdViewController getFlipperView]; if ([flipperView canGoBack]) { [flipperView back]; return; } IpuAlertView *alertView = [[IpuAlertView alloc] initWithTitle:@"提示" message:@"当前为最上层页面,无法返回!" block:^(IpuAlertView *alertView, BOOL isCancel, NSInteger buttonIndex) { } cancelButtonTitle:@"确定" otherButtonTitles:nil]; [alertView show]; } } else if ([viewController isKindOfClass:[IpuRNBaseViewController class]]) { [viewController dismissViewControllerAnimated:YES completion:nil]; } else { if (viewController == [UIApplication sharedApplication].delegate.window.rootViewController) { IpuAlertView *alertView = [[IpuAlertView alloc] initWithTitle:@"提示" message:@"当前为最上层页面,无法返回!" block:^(IpuAlertView *alertView, BOOL isCancel, NSInteger buttonIndex) { } cancelButtonTitle:@"确定" otherButtonTitles:nil]; [alertView show]; } else { [viewController dismissViewControllerAnimated:YES completion:nil]; } } } - (UIStatusBarStyle)preferredStatusBarStyle{ return UIStatusBarStyleLightContent; } @end