前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >Objective-C自学笔记(1)-AppDelegate.m

Objective-C自学笔记(1)-AppDelegate.m

作者头像
timhbw
发布2018-05-03 10:49:47
7980
发布2018-05-03 10:49:47
举报
文章被收录于专栏:Timhbw博客Timhbw博客

2016-05-0506:58:49 发表评论 353℃热度

写一些平时看书学习iOS的笔记,基础的、进阶的都有,供以后回顾,也可以让刚开始学习的同学学习。

Objective-C自学笔记(1)-AppDelegate.m
Objective-C自学笔记(1)-AppDelegate.m

一些基本文件的解释:

  1. #import "AppDelegate.h"
  2. @interface AppDelegate ()
  3. @end
  4. @implementation AppDelegate
  5. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
  6.     // Override point for customization after application launch.
  7.     //可以在这里重载应用程序启动后的自定义代码
  8.     return YES;
  9. }
  10. - (void)applicationWillResignActive:(UIApplication *)application {
  11.     // 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.
  12.     //应用程序从活动状态切换到非活动状态时会触发这个方法。在出现某种临时中断(比如来电话或者短信)或用户退出应用程序时都会触发。然后应用程序就会转为后台运行。
  13.     // 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.
  14.     //可以在这个方法中暂停正在运行的任务、禁用定时器和降低OpenGL ES帧率。如果是游戏应用,可以在这个方法中暂停游戏。
  15. }
  16. - (void)applicationDidEnterBackground:(UIApplication *)application {
  17.     // 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.
  18.     //在该方法中释放公用资源、保存用户数据、取消定时器,并尽量存储应用程序状态信息,这样万一后面应用程序被终止了,将来可以恢复到当前状态。
  19.     // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
  20.     //如果你的应用程序支持在后台运行,那么当用户退出时会调用这个方法而不是applicationWillTerminate方法。
  21. }
  22. - (void)applicationWillEnterForeground:(UIApplication *)application {
  23.     // 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.
  24.     //这个方法会在应用程序从后台运行状态转换到活动状态的过程中被调用,可以在这里恢复应用程序正常运行所需要的信息。
  25. }
  26. - (void)applicationDidBecomeActive:(UIApplication *)application {
  27.     // 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.
  28.     //重启应用程序在非活动状态被暂停(或者尚未启动)的任务。如果应用程序之前在后台运行,那么可以选择是否刷新用户界面。
  29. }
  30. - (void)applicationWillTerminate:(UIApplication *)application {
  31.     // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
  32.     //程序即将终止时会调用孩方法。请尽可能保存数据。参考applicationDidEnterBackground方法
  33. }
  34. @end
本文参与 腾讯云自媒体分享计划,分享自作者个人站点/博客。
原始发表:2016-05-050,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 作者个人站点/博客 前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体分享计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
相关产品与服务
短信
腾讯云短信(Short Message Service,SMS)可为广大企业级用户提供稳定可靠,安全合规的短信触达服务。用户可快速接入,调用 API / SDK 或者通过控制台即可发送,支持发送验证码、通知类短信和营销短信。国内验证短信秒级触达,99%到达率;国际/港澳台短信覆盖全球200+国家/地区,全球多服务站点,稳定可靠。
领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档