{"id":329,"date":"2014-04-11T12:26:38","date_gmt":"2014-04-11T04:26:38","guid":{"rendered":"http:\/\/www.yusian.com\/blog\/?p=329"},"modified":"2016-07-15T17:29:13","modified_gmt":"2016-07-15T09:29:13","slug":"ios%e7%a8%8b%e5%ba%8f%e8%bf%90%e8%a1%8c%e8%bf%87%e7%a8%8b%e8%a7%a3%e6%9e%90","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/project\/2014\/04\/11\/122638329.html","title":{"rendered":"ios\u7a0b\u5e8f\u8fd0\u884c\u8fc7\u7a0b\u89e3\u6790"},"content":{"rendered":"<p><strong>1\u3001\u6267\u884cmain\u51fd\u6570\uff1b<\/strong><\/p>\n<p><strong>2\u3001\u6267\u884cmain\u51fd\u6570\u8c03\u7528\u7684UIApplicationMain\u51fd\u6570\uff1b<\/strong><br \/>\n2.1 \u521b\u5efaUIApplication\u5b9e\u4f8b\uff0c\u8fd9\u662f\u4e00\u4e2a\u5355\u4f8b\uff0cUIApplication\u5bf9\u8c61\u662f\u5e94\u7528\u7a0b\u5e8f\u7684\u8c61\u5f81\uff1b<br \/>\n2.2 \u5f00\u542f\u6d88\u606f\u5faa\u73af main loop<br \/>\n2.3 \u521b\u5efa\u4e00\u4e2aUIApplication\u7684delegate\u5bf9\u8c61\uff08UIApplicationMain\u51fd\u6570\u7684\u53c2\u6570\u4e2d\u4f20\u5165\uff09\uff0c\u8d1f\u8d23\u76d1\u542cUIApplication\u6574\u4e2a\u751f\u547d\u5468\u671f\uff0cUIApplication\u751f\u547d\u5468\u671f\u4e2d\u7684\u5404\u79cd\u4e8b\u4ef6\u5904\u7406\u5747\u7531delegate\u8d1f\u8d23\uff1b<\/p>\n<p><strong>3\u3001delegate\u4e2d\u7684\u65b9\u6cd5\u8bf4\u660e\uff1a<\/strong><br \/>\n\u65b9\u6cd5\u4e00\uff1a<\/p>\n<pre lang=\"objc\" line=\"1\">- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions\n\/\/ \u8be5\u65b9\u6cd5\u5728\u5e94\u7528\u7a0b\u5e8f\u52a0\u8f7d\u5b8c\u6bd5\u540e\u8c03\u7528\uff0c\u521d\u59cb\u5316\u754c\u9762\u6216\u521b\u5efa\u754c\u9762\u5143\u7d20\u5728\u8be5\u65b9\u6cd5\u4e2d\u5b9e\u73b0\uff1b<\/pre>\n<p>\u65b9\u6cd5\u4e8c\uff1a<\/p>\n<pre lang=\"objc\" line=\"1\">- (void)applicationWillResignActive:(UIApplication *)application\n\/\/ \u5e94\u7528\u7a0b\u5e8f\u88ab\u6302\u8d77\u65f6\u8c03\u7528<\/pre>\n<p>\u65b9\u6cd5\u4e09\uff1a<\/p>\n<pre lang=\"objc\" line=\"1\">- (void)applicationDidEnterBackground:(UIApplication *)application\n\/\/ \u5e94\u7528\u7a0b\u5e8f\u8fdb\u5165\u540e\u53f0\u65f6\u88ab\u8c03\u7528<\/pre>\n<p>\u65b9\u6cd5\u56db\uff1a<\/p>\n<pre lang=\"objc\" line=\"1\">- (void)applicationWillEnterForeground:(UIApplication *)application\n\/\/ \u5e94\u7528\u7a0b\u5e8f\u8fdb\u5165\u524d\u53f0\u65f6\u88ab\u8c03\u7528<\/pre>\n<p>\u65b9\u6cd5\u4e94\uff1a<\/p>\n<pre lang=\"objc\" line=\"1\">- (void)applicationDidBecomeActive:(UIApplication *)application\n\/\/ \u5e94\u7528\u7a0b\u5e8f\u88ab\u6fc0\u6d3b\u65f6\u8c03\u7528<\/pre>\n<p>\u65b9\u6cd5\u516d\uff1a<\/p>\n<pre lang=\"objc\" line=\"1\">- (void)applicationWillTerminate:(UIApplication *)application\n\/\/ \u5e94\u7528\u7a0b\u5e8f\u88ab\u7ec8\u7ed3\u65f6\u8c03\u7528<\/pre>\n<p>3.1 \u6253\u5f00\u5e94\u7528\u7a0b\u5e8f\u65f6\u4f1a\u8c03\u7528\u65b9\u6cd5\u4e00\u4e0e\u65b9\u6cd5\u4e94\uff1b<br \/>\n3.2 \u70b9\u51fbHome\u952e\u65f6\u4f1a\u8c03\u7528\u65b9\u6cd5\u4e8c\u4e0e\u65b9\u6cd5\u4e09\uff1b<br \/>\n3.3 \u518d\u6b21\u6253\u5f00\u5e94\u7528\u7a0b\u5e8f\u65f6\u4f1a\u8c03\u7528\u65b9\u6cd5\u56db\u4e0e\u65b9\u6cd5\u4e94\uff1b<br \/>\n3.4 \u7a0b\u5e8f\u9000\u51fa\u65f6\u8c03\u7528\u65b9\u6cd5\u516d\uff0c\u6ce8\u610f\uff1a\u6309Home\u952e\u4e0d\u662f\u9000\u51fa\u7a0b\u5e8f\uff0c\u53ea\u662f\u5c06\u7a0b\u5e8f\u6302\u8d77\u5230\u540e\u53f0\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u6267\u884cmain\u51fd\u6570\uff1b 2\u3001\u6267\u884cmain\u51fd\u6570\u8c03\u7528\u7684UIApplicationMain\u51fd\u6570\uff1b 2.1 \u521b\u5efaUIApplication\u5b9e\u4f8b\uff0c\u8fd9\u662f\u4e00\u4e2a\u5355\u4f8b\uff0cUIApplication\u5bf9\u8c61\u662f\u5e94\u7528\u7a0b\u5e8f\u7684\u8c61\u5f81\uff1b 2.2 \u5f00\u542f\u6d88\u606f\u5faa\u73af main loop 2.3 \u521b\u5efa\u4e00\u4e2aUIApplication\u7684delegate\u5bf9\u8c61\uff08UIApplicationMain\u51fd\u6570\u7684\u53c2\u6570\u4e2d\u4f20\u5165\uff09\uff0c\u8d1f\u8d23\u76d1\u542cUIApplication\u6574\u4e2a\u751f\u547d\u5468\u671f\uff0cUIApplication\u751f\u547d\u5468\u671f\u4e2d\u7684\u5404\u79cd\u4e8b\u4ef6\u5904\u7406\u5747\u7531delegate\u8d1f\u8d23\uff1b 3\u3001delegate\u4e2d\u7684\u65b9\u6cd5\u8bf4\u660e\uff1a \u65b9\u6cd5\u4e00\uff1a &#8211; (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions \/\/ \u8be5\u65b9\u6cd5\u5728\u5e94\u7528\u7a0b\u5e8f\u52a0\u8f7d\u5b8c\u6bd5\u540e\u8c03\u7528\uff0c\u521d\u59cb\u5316\u754c\u9762\u6216\u521b\u5efa\u754c\u9762\u5143\u7d20\u5728\u8be5\u65b9\u6cd5\u4e2d\u5b9e\u73b0\uff1b \u65b9\u6cd5\u4e8c\uff1a &#8211; (void)applicationWillResignActive:(UIApplication *)application \/\/ \u5e94\u7528\u7a0b\u5e8f\u88ab\u6302\u8d77\u65f6\u8c03\u7528 \u65b9\u6cd5\u4e09\uff1a &#8211; (void)applicationDidEnterBackground:(UIApplication *)application \/\/ \u5e94\u7528\u7a0b\u5e8f\u8fdb\u5165\u540e\u53f0\u65f6\u88ab\u8c03\u7528 \u65b9\u6cd5\u56db\uff1a &#8211; (void)applicationWillEnterForeground:(UIApplication *)application \/\/ \u5e94\u7528\u7a0b\u5e8f\u8fdb\u5165\u524d\u53f0\u65f6\u88ab\u8c03\u7528 \u65b9\u6cd5\u4e94\uff1a &#8211; (void)applicationDidBecomeActive:(UIApplication *)application \/\/ \u5e94\u7528\u7a0b\u5e8f\u88ab\u6fc0\u6d3b\u65f6\u8c03\u7528 \u65b9\u6cd5\u516d\uff1a &#8211; (void)applicationWillTerminate:(UIApplication *)application \/\/ \u5e94\u7528\u7a0b\u5e8f\u88ab\u7ec8\u7ed3\u65f6\u8c03\u7528 3.1 \u6253\u5f00\u5e94\u7528\u7a0b\u5e8f\u65f6\u4f1a\u8c03\u7528\u65b9\u6cd5\u4e00\u4e0e\u65b9\u6cd5\u4e94\uff1b 3.2 \u70b9\u51fbHome\u952e\u65f6\u4f1a\u8c03\u7528\u65b9\u6cd5\u4e8c\u4e0e\u65b9\u6cd5\u4e09\uff1b 3.3 \u518d\u6b21\u6253\u5f00\u5e94\u7528\u7a0b\u5e8f\u65f6\u4f1a\u8c03\u7528\u65b9\u6cd5\u56db\u4e0e\u65b9\u6cd5\u4e94\uff1b [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[20],"class_list":["post-329","post","type-post","status-publish","format-standard","hentry","category-project","tag-basics"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/329","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=329"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/329\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=329"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=329"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=329"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}