AppDelegate unity 相关修改

#import

@interfaceAppDelegate :UIResponder

@property(strong,nonatomic)UIWindow*window;

@property(strong,nonatomic)UIWindow*unityWindow;

@property(strong,nonatomic)UnityAppController*unityController;

- (void)showUnityWindow;

- (void)hideUnityWindow;

@end

#import"AppDelegate.h"

#import"ViewController.h"

#import"NavigationController.h"

@interfaceAppDelegate()

@property(strong,nonatomic)NavigationController*naviVC;

@end

@implementationAppDelegate

-(UIWindow*)unityWindow{

returnUnityGetMainWindow();

}

-(void)showUnityWindow{

[self.unityWindowmakeKeyAndVisible];

}

-(void)hideUnityWindow{

[self.windowmakeKeyAndVisible];

}

- (BOOL)application:(UIApplication*)application didFinishLaunchingWithOptions:(NSDictionary*)launchOptions {

// Override point for customization after application launch.

self.window= [[UIWindowalloc]initWithFrame:[UIScreenmainScreen].bounds];

self.window.backgroundColor= [UIColorwhiteColor];

self.naviVC= [[NavigationControlleralloc]initWithRootViewController:[[ViewControlleralloc]init]];

self.window.rootViewController=self.naviVC;

self.unityController= [[UnityAppControlleralloc]init];

[self.unityControllerapplication:applicationdidFinishLaunchingWithOptions:launchOptions];

[self.windowmakeKeyAndVisible];

returnYES;

}

- (void)applicationWillResignActive:(UIApplication*)application {

// Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.

// Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.

[self.unityControllerapplicationWillResignActive:application];

}

- (void)applicationDidEnterBackground:(UIApplication*)application {

// Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.

// If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.

[self.unityControllerapplicationDidEnterBackground:application];

}

- (void)applicationWillEnterForeground:(UIApplication*)application {

// Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.

[self.unityControllerapplicationWillEnterForeground:application];

}

- (void)applicationDidBecomeActive:(UIApplication*)application {

// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.

[self.unityControllerapplicationDidBecomeActive:application];

}

- (void)applicationWillTerminate:(UIApplication*)application {

// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.

// Saves changes in the application's managed object context before the application terminates.

[selfapplicationWillTerminate:application];

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

  • 网址:http://www.meituan.com/api/v1/divisions #import #impor...
    lichengjin阅读 3,584评论 2 0
  • 一、 导入AudioToolBox.framework apple系统默认声音名称说明: 1.声音格式是MP3或m...
    _源计划阅读 3,308评论 0 0
  • 本文由伊小影(微信号:loveyixiaoying)授权发布 作者:伊小影 喜爱音乐、喜欢PPT、喜欢漫无边际的遐...
    伊索煜言阅读 1,495评论 0 0
  • 仰望深邃夜空 穿越亿万光年 光影交错着 无尽心事 相逢时思念伫足 曾以怎样的面貌 与你相遇 曾以怎样的心情 与你对...
    塵光阅读 2,472评论 0 4
  • 今天和家长探讨孩子的专注力和注意力的问题,家长表示确实分不清楚,我们就大概聊了专注力是可以后天养成的,注意力是先天...
    朵朵颐阅读 1,463评论 4 3

友情链接更多精彩内容