UI-对AppDelegate.m中方法简介的翻译

将注释看明白后对以后的学习很有帮助,注释中不仅有专业的解释,还有对一些用户使用情况的举例,很形象直观!

1.

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

{

// Override point for customization after application launch.

翻译:APP启动后的自定义点

解释:APP启动后会走这个方法

}

2.

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

// Sent when the application is about to move from active to inactive state.

翻译:在APP即将从活跃状态转换到非活跃状态时要发送此消息

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.

翻译:有如下几种会临时打断程序活跃运行状态的情况:(比如突然的呼入电话或接收到的短讯息)或当用户退出APP后,程序就会自行转换到后台运行时的状态

// 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.

翻译:使用此方法来暂停运行中的任务,使timer暂时停止工作,放缓OpenGL ES的帧频.如果是游戏则应该使用这个方法来暂停游戏.

解释:APP即将进入非活跃状态时会走这个方法

}

3.

- (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.

翻译:使用此方法来释放共享资源,保存用户数据,撤销计时器,并且储存足够的可以使您的APP重新恢复到当前状态的程序状态信息,以防程序被终止后发生数据丢失.

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

翻译:如果您的APP支持后台运行,这个方法可以成为applicationWillTerminate方法的替代方法

解释:程序进入后台时会走这个方法

}

4.

- (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.

翻译:此方法是APP由后台转换到非活跃状态过程的一部分;在这里你可以撤销APP在进入后台运行时做过的操作

解释:程序回到前台时会走这个方法

}

5.

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

// Restart any tasks that were paused (or not yet started) while the application was inactive.

翻译:可以重新运行在APP进入非活跃状态时暂停(或还没开始的)任何任务

If the application was previously in the background, optionally refresh the user interface.

翻译:如果app还在后台运行,视情况可以时刷新用户界面

解释:程序恢复活跃状态时会走这个方法

}

6.

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

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

翻译:此方法会在程序即将关闭时被调用.它会在恰当的时候存储数据.查看app是否结束运行(或进入后台运行状态).

解释:程序即将退出时会走这个方法

}

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • Spring Cloud为开发人员提供了快速构建分布式系统中一些常见模式的工具(例如配置管理,服务发现,断路器,智...
    卡卡罗2017阅读 134,991评论 19 139
  • Android 自定义View的各种姿势1 Activity的显示之ViewRootImpl详解 Activity...
    passiontim阅读 173,540评论 25 708
  • UIApplication深入研究 很多时候,我们不需要关心这个类,我们很少继承这个类,偶尔会调用这个类的api来...
    谁的青春不迷茫阅读 1,833评论 1 7
  • "你站在桥上看风景,看风景的人在桥下看你。明月装饰了你的窗子,你装饰了别人的梦"。人们总是在相互羡慕与欣赏...
    菜瓜饭阅读 717评论 3 4
  • 作为一个大理人,与大理而言,我应该算不上是一个游客,然而很多时候我却喜欢以一个游客的身份穿梭在人来人往中。...
    欢歌旅行迹阅读 527评论 10 4