侧边栏壁纸
博主头像
伯虔

追求源于热爱,极致源于梦想!

  • 累计撰写 98 篇文章
  • 累计创建 30 个标签
  • 累计收到 4 条评论

目 录CONTENT

文章目录

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

伯虔
2016-05-05 / 0 评论 / 0 点赞 / 690 阅读 / 2,355 字 / 正在检测是否收录...
温馨提示:
本文最后更新于 2022-03-26,若内容或图片失效,请留言反馈。部分素材来自网络,若不小心影响到您的利益,请联系我们删除。

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

一些基本文件的解释:

#import "AppDelegate.h"
@interface AppDelegate ()
@end 
@implementation AppDelegate 
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 

// Override point for customization after application launch. //可以在这里重载应用程序启动后的自定义代码 
return YES; } 

- (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. 
//可以在这个方法中暂停正在运行的任务、禁用定时器和降低OpenGL ES帧率。如果是游戏应用,可以在这个方法中暂停游戏。 
} 

- (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. 
//如果你的应用程序支持在后台运行,那么当用户退出时会调用这个方法而不是applicationWillTerminate方法。 
} 
- (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. 
//这个方法会在应用程序从后台运行状态转换到活动状态的过程中被调用,可以在这里恢复应用程序正常运行所需要的信息。 
} 
- (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. 
//重启应用程序在非活动状态被暂停(或者尚未启动)的任务。如果应用程序之前在后台运行,那么可以选择是否刷新用户界面。 
} 
- (void)applicationWillTerminate:(UIApplication *)application { 

// Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. 
//程序即将终止时会调用孩方法。请尽可能保存数据。参考applicationDidEnterBackground方法 
} 
@end
0

评论区