{"id":898,"date":"2026-02-11T11:05:55","date_gmt":"2026-02-11T03:05:55","guid":{"rendered":"https:\/\/www.ixriver.com\/?p=898"},"modified":"2026-02-11T11:05:55","modified_gmt":"2026-02-11T03:05:55","slug":"ios-%e5%8d%a1%e9%a1%bf%e4%bc%98%e5%8c%96","status":"publish","type":"post","link":"https:\/\/ixriver.com\/?p=898","title":{"rendered":"iOS \u5361\u987f\u4f18\u5316"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_65 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title \" >\u76ee\u5f55<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" aria-label=\"Toggle Table of Content\"><span class=\"ez-toc-js-icon-con\"><span class=\"\"><span class=\"eztoc-hide\" style=\"display:none;\">Toggle<\/span><span class=\"ez-toc-icon-toggle-span\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/span><\/span><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/ixriver.com\/?p=898\/#iOS_%E5%8D%A1%E9%A1%BF%E4%BC%98%E5%8C%96\" title=\"iOS \u5361\u987f\u4f18\u5316\">iOS \u5361\u987f\u4f18\u5316<\/a><ul class='ez-toc-list-level-2' ><li class='ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/ixriver.com\/?p=898\/#%E4%B8%80%E3%80%81%E5%8E%9F%E7%90%86\" title=\"\u4e00\u3001\u539f\u7406\">\u4e00\u3001\u539f\u7406<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/ixriver.com\/?p=898\/#11_%E5%B1%8F%E5%B9%95%E6%98%BE%E7%A4%BA%E5%9B%BE%E5%83%8F%E5%8E%9F%E7%90%86\" title=\"1.1 \u5c4f\u5e55\u663e\u793a\u56fe\u50cf\u539f\u7406\">1.1 \u5c4f\u5e55\u663e\u793a\u56fe\u50cf\u539f\u7406<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/ixriver.com\/?p=898\/#12_%E5%8D%A1%E9%A1%BF%E4%BA%A7%E7%94%9F%E7%9A%84%E5%8E%9F%E5%9B%A0\" title=\"1.2 \u5361\u987f\u4ea7\u751f\u7684\u539f\u56e0\">1.2 \u5361\u987f\u4ea7\u751f\u7684\u539f\u56e0<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-5\" href=\"https:\/\/ixriver.com\/?p=898\/#13_iOS_%E6%B8%B2%E6%9F%93%E5%BE%AA%E7%8E%AF\" title=\"1.3 iOS \u6e32\u67d3\u5faa\u73af\">1.3 iOS \u6e32\u67d3\u5faa\u73af<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-6\" href=\"https:\/\/ixriver.com\/?p=898\/#131_%E4%BA%8B%E4%BB%B6%E5%87%86%E5%A4%87\" title=\"1.3.1 \u4e8b\u4ef6\u51c6\u5907\">1.3.1 \u4e8b\u4ef6\u51c6\u5907<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-7\" href=\"https:\/\/ixriver.com\/?p=898\/#132_%E6%8F%90%E4%BA%A4%E9%98%B6%E6%AE%B5\" title=\"1.3.2 \u63d0\u4ea4\u9636\u6bb5\">1.3.2 \u63d0\u4ea4\u9636\u6bb5<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-8\" href=\"https:\/\/ixriver.com\/?p=898\/#133_%E6%B8%B2%E6%9F%93%E5%87%86%E5%A4%87\" title=\"1.3.3 \u6e32\u67d3\u51c6\u5907\">1.3.3 \u6e32\u67d3\u51c6\u5907<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-9\" href=\"https:\/\/ixriver.com\/?p=898\/#134_%E6%B8%B2%E6%9F%93%E6%89%A7%E8%A1%8C\" title=\"1.3.4 \u6e32\u67d3\u6267\u884c\">1.3.4 \u6e32\u67d3\u6267\u884c<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-10\" href=\"https:\/\/ixriver.com\/?p=898\/#135_%E5%B1%95%E7%A4%BA%E9%98%B6%E6%AE%B5\" title=\"1.3.5 \u5c55\u793a\u9636\u6bb5\">1.3.5 \u5c55\u793a\u9636\u6bb5<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-11\" href=\"https:\/\/ixriver.com\/?p=898\/#14_App_%E5%8D%A1%E9%A1%BF%E7%AD%89%E7%BA%A7_%E2%80%93_%E5%8D%A1%E9%A1%BF%E6%97%B6%E9%97%B4%E6%AF%94\" title=\"1.4 App \u5361\u987f\u7b49\u7ea7 &#8211; \u5361\u987f\u65f6\u95f4\u6bd4\">1.4 App \u5361\u987f\u7b49\u7ea7 &#8211; \u5361\u987f\u65f6\u95f4\u6bd4<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-12\" href=\"https:\/\/ixriver.com\/?p=898\/#15_%E6%93%8D%E4%BD%9C%E5%8D%A1%E9%A1%BF%E7%AD%89%E7%BA%A7\" title=\"1.5 \u64cd\u4f5c\u5361\u987f\u7b49\u7ea7\">1.5 \u64cd\u4f5c\u5361\u987f\u7b49\u7ea7<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-13\" href=\"https:\/\/ixriver.com\/?p=898\/#%E4%BA%8C%E3%80%81%E7%BA%BF%E4%B8%8B%E7%9B%91%E6%8E%A7%E6%96%B9%E6%A1%88\" title=\"\u4e8c\u3001\u7ebf\u4e0b\u76d1\u63a7\u65b9\u6848\">\u4e8c\u3001\u7ebf\u4e0b\u76d1\u63a7\u65b9\u6848<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-14\" href=\"https:\/\/ixriver.com\/?p=898\/#21_Xcode\" title=\"2.1 Xcode\">2.1 Xcode<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-15\" href=\"https:\/\/ixriver.com\/?p=898\/#211_%E6%B8%B2%E6%9F%93%E9%80%89%E9%A1%B9\" title=\"2.1.1 \u6e32\u67d3\u9009\u9879\">2.1.1 \u6e32\u67d3\u9009\u9879<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-16\" href=\"https:\/\/ixriver.com\/?p=898\/#212_%E5%85%B6%E5%AE%83\" title=\"2.1.2 \u5176\u5b83\">2.1.2 \u5176\u5b83<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-17\" href=\"https:\/\/ixriver.com\/?p=898\/#22_Instruments\" title=\"2.2 Instruments\">2.2 Instruments<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-18\" href=\"https:\/\/ixriver.com\/?p=898\/#221_Animation_Hitches\" title=\"2.2.1 Animation Hitches\">2.2.1 Animation Hitches<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-19\" href=\"https:\/\/ixriver.com\/?p=898\/#222_OpenGL_ES%EF%BC%88%E5%B7%B2%E5%BA%9F%E5%BC%83%EF%BC%89\" title=\"2.2.2 OpenGL ES\uff08\u5df2\u5e9f\u5f03\uff09\">2.2.2 OpenGL ES\uff08\u5df2\u5e9f\u5f03\uff09<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-20\" href=\"https:\/\/ixriver.com\/?p=898\/#%E4%B8%89%E3%80%81%E7%BA%BF%E4%B8%8A%E7%9B%91%E6%8E%A7%E6%96%B9%E6%A1%88\" title=\"\u4e09\u3001\u7ebf\u4e0a\u76d1\u63a7\u65b9\u6848\">\u4e09\u3001\u7ebf\u4e0a\u76d1\u63a7\u65b9\u6848<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-21\" href=\"https:\/\/ixriver.com\/?p=898\/#31_%E7%9B%91%E6%8E%A7_FPS\" title=\"3.1 \u76d1\u63a7 FPS\">3.1 \u76d1\u63a7 FPS<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-22\" href=\"https:\/\/ixriver.com\/?p=898\/#32_%E7%9B%91%E6%8E%A7_RunLoop\" title=\"3.2 \u76d1\u63a7 RunLoop\">3.2 \u76d1\u63a7 RunLoop<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-23\" href=\"https:\/\/ixriver.com\/?p=898\/#321_%E9%AB%98%E5%8F%AF%E7%94%A8%E5%8D%A1%E9%A1%BF%E6%A3%80%E6%B5%8B\" title=\"3.2.1 \u9ad8\u53ef\u7528\u5361\u987f\u68c0\u6d4b\">3.2.1 \u9ad8\u53ef\u7528\u5361\u987f\u68c0\u6d4b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-24\" href=\"https:\/\/ixriver.com\/?p=898\/#322_Core_Animation_%E8%A7%82%E5%AF%9F%E8%80%85%E6%A8%A1%E5%BC%8F\" title=\"3.2.2 Core Animation \u89c2\u5bdf\u8005\u6a21\u5f0f\">3.2.2 Core Animation \u89c2\u5bdf\u8005\u6a21\u5f0f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-25\" href=\"https:\/\/ixriver.com\/?p=898\/#323_%E5%8D%A1%E9%A1%BF\" title=\"3.2.3 \u5361\u987f\">3.2.3 \u5361\u987f<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-26\" href=\"https:\/\/ixriver.com\/?p=898\/#324_%E5%8D%A1%E6%AD%BB\" title=\"3.2.4 \u5361\u6b7b\">3.2.4 \u5361\u6b7b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-27\" href=\"https:\/\/ixriver.com\/?p=898\/#325_%E5%8D%A1%E9%A1%BF%E5%A0%86%E6%A0%88%E9%87%87%E9%9B%86%E4%BC%98%E5%8C%96\" title=\"3.2.5 \u5361\u987f\u5806\u6808\u91c7\u96c6\u4f18\u5316\">3.2.5 \u5361\u987f\u5806\u6808\u91c7\u96c6\u4f18\u5316<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-28\" href=\"https:\/\/ixriver.com\/?p=898\/#326_%E5%90%8E%E5%8F%B0%E5%8D%A1%E6%AD%BB%E8%AF%AF%E6%8A%A5\" title=\"3.2.6 \u540e\u53f0\u5361\u6b7b\u8bef\u62a5\">3.2.6 \u540e\u53f0\u5361\u6b7b\u8bef\u62a5<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-29\" href=\"https:\/\/ixriver.com\/?p=898\/#327_%E7%9B%B8%E5%90%8C%E5%8D%A1%E9%A1%BF%E4%BC%98%E5%8C%96_%E2%80%93_%E9%80%80%E7%81%AB%E7%AE%97%E6%B3%95\" title=\"3.2.7 \u76f8\u540c\u5361\u987f\u4f18\u5316 &#8211; \u9000\u706b\u7b97\u6cd5\">3.2.7 \u76f8\u540c\u5361\u987f\u4f18\u5316 &#8211; \u9000\u706b\u7b97\u6cd5<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-30\" href=\"https:\/\/ixriver.com\/?p=898\/#33_%E4%B8%BB%E7%BA%BF%E7%A8%8B%E6%B6%88%E6%81%AF%E6%8E%A2%E6%B5%8B\" title=\"3.3 \u4e3b\u7ebf\u7a0b\u6d88\u606f\u63a2\u6d4b\">3.3 \u4e3b\u7ebf\u7a0b\u6d88\u606f\u63a2\u6d4b<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-31\" href=\"https:\/\/ixriver.com\/?p=898\/#%E5%9B%9B%E3%80%81%E4%BC%98%E5%8C%96%E5%BB%BA%E8%AE%AE\" title=\"\u56db\u3001\u4f18\u5316\u5efa\u8bae\">\u56db\u3001\u4f18\u5316\u5efa\u8bae<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-32\" href=\"https:\/\/ixriver.com\/?p=898\/#41_CPU_%E4%BC%98%E5%8C%96\" title=\"4.1 CPU \u4f18\u5316\">4.1 CPU \u4f18\u5316<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-33\" href=\"https:\/\/ixriver.com\/?p=898\/#%E5%AF%B9%E8%B1%A1%E5%88%9B%E5%BB%BA\" title=\"\u5bf9\u8c61\u521b\u5efa\">\u5bf9\u8c61\u521b\u5efa<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-34\" href=\"https:\/\/ixriver.com\/?p=898\/#%E5%AF%B9%E8%B1%A1%E8%B0%83%E6%95%B4\" title=\"\u5bf9\u8c61\u8c03\u6574\">\u5bf9\u8c61\u8c03\u6574<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-35\" href=\"https:\/\/ixriver.com\/?p=898\/#%E5%AF%B9%E8%B1%A1%E9%94%80%E6%AF%81\" title=\"\u5bf9\u8c61\u9500\u6bc1\">\u5bf9\u8c61\u9500\u6bc1<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-36\" href=\"https:\/\/ixriver.com\/?p=898\/#%E5%B8%83%E5%B1%80%E8%AE%A1%E7%AE%97%E5%92%8C_AutoLayout\" title=\"\u5e03\u5c40\u8ba1\u7b97\u548c AutoLayout\">\u5e03\u5c40\u8ba1\u7b97\u548c AutoLayout<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-37\" href=\"https:\/\/ixriver.com\/?p=898\/#%E6%96%87%E6%9C%AC%E8%AE%A1%E7%AE%97\" title=\"\u6587\u672c\u8ba1\u7b97\">\u6587\u672c\u8ba1\u7b97<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-38\" href=\"https:\/\/ixriver.com\/?p=898\/#%E6%96%87%E6%9C%AC%E7%BB%98%E5%88%B6\" title=\"\u6587\u672c\u7ed8\u5236\">\u6587\u672c\u7ed8\u5236<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-39\" href=\"https:\/\/ixriver.com\/?p=898\/#%E5%9B%BE%E7%89%87%E8%A7%A3%E7%A0%81\" title=\"\u56fe\u7247\u89e3\u7801\">\u56fe\u7247\u89e3\u7801<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-40\" href=\"https:\/\/ixriver.com\/?p=898\/#%E5%9B%BE%E5%83%8F%E7%BB%98%E5%88%B6\" title=\"\u56fe\u50cf\u7ed8\u5236\">\u56fe\u50cf\u7ed8\u5236<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-41\" href=\"https:\/\/ixriver.com\/?p=898\/#411_%E5%9B%BE%E5%83%8F%E5%8A%A0%E8%BD%BD\" title=\"4.1.1 \u56fe\u50cf\u52a0\u8f7d\">4.1.1 \u56fe\u50cf\u52a0\u8f7d<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-42\" href=\"https:\/\/ixriver.com\/?p=898\/#42_GPU_%E4%BC%98%E5%8C%96\" title=\"4.2 GPU \u4f18\u5316\">4.2 GPU \u4f18\u5316<\/a><ul class='ez-toc-list-level-4' ><li class='ez-toc-heading-level-4'><a class=\"ez-toc-link ez-toc-heading-43\" href=\"https:\/\/ixriver.com\/?p=898\/#421_%E7%A6%BB%E5%B1%8F%E6%B8%B2%E6%9F%93\" title=\"4.2.1 \u79bb\u5c4f\u6e32\u67d3\">4.2.1 \u79bb\u5c4f\u6e32\u67d3<\/a><ul class='ez-toc-list-level-5' ><li class='ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-44\" href=\"https:\/\/ixriver.com\/?p=898\/#4211_%E7%A6%BB%E5%B1%8F%E6%B8%B2%E6%9F%93%E5%8E%9F%E7%90%86\" title=\"4.2.1.1 \u79bb\u5c4f\u6e32\u67d3\u539f\u7406\">4.2.1.1 \u79bb\u5c4f\u6e32\u67d3\u539f\u7406<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-5'><a class=\"ez-toc-link ez-toc-heading-45\" href=\"https:\/\/ixriver.com\/?p=898\/#4212_%E5%9C%86%E8%A7%92%E7%A6%BB%E5%B1%8F%E6%B8%B2%E6%9F%93\" title=\"4.2.1.2 \u5706\u89d2\u79bb\u5c4f\u6e32\u67d3\">4.2.1.2 \u5706\u89d2\u79bb\u5c4f\u6e32\u67d3<\/a><\/li><\/ul><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-46\" href=\"https:\/\/ixriver.com\/?p=898\/#43_%E9%AB%98%E6%95%88%E7%BB%98%E5%9B%BE\" title=\"4.3 \u9ad8\u6548\u7ed8\u56fe\">4.3 \u9ad8\u6548\u7ed8\u56fe<\/a><\/li><\/ul><\/li><li class='ez-toc-page-1 ez-toc-heading-level-2'><a class=\"ez-toc-link ez-toc-heading-47\" href=\"https:\/\/ixriver.com\/?p=898\/#%E4%BA%94%E3%80%81%E4%BC%98%E5%8C%96%E6%A1%88%E4%BE%8B\" title=\"\u4e94\u3001\u4f18\u5316\u6848\u4f8b\">\u4e94\u3001\u4f18\u5316\u6848\u4f8b<\/a><ul class='ez-toc-list-level-3' ><li class='ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-48\" href=\"https:\/\/ixriver.com\/?p=898\/#51_%E7%BD%91%E7%BB%9C%E6%93%8D%E4%BD%9C%E6%94%BE%E5%88%B0%E9%9D%9E%E4%B8%BB%E7%BA%BF%E7%A8%8B\" title=\"5.1 \u7f51\u7edc\u64cd\u4f5c\u653e\u5230\u975e\u4e3b\u7ebf\u7a0b\">5.1 \u7f51\u7edc\u64cd\u4f5c\u653e\u5230\u975e\u4e3b\u7ebf\u7a0b<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-3'><a class=\"ez-toc-link ez-toc-heading-49\" href=\"https:\/\/ixriver.com\/?p=898\/#52_%E6%B8%B2%E6%9F%93%E5%8D%A1%E9%A1%BF\" title=\"5.2 \u6e32\u67d3\u5361\u987f\">5.2 \u6e32\u67d3\u5361\u987f<\/a><\/li><\/ul><\/li><\/ul><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"iOS_%E5%8D%A1%E9%A1%BF%E4%BC%98%E5%8C%96\"><\/span>iOS \u5361\u987f\u4f18\u5316<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<h2><span class=\"ez-toc-section\" id=\"%E4%B8%80%E3%80%81%E5%8E%9F%E7%90%86\"><\/span>\u4e00\u3001\u539f\u7406<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"11_%E5%B1%8F%E5%B9%95%E6%98%BE%E7%A4%BA%E5%9B%BE%E5%83%8F%E5%8E%9F%E7%90%86\"><\/span>1.1 \u5c4f\u5e55\u663e\u793a\u56fe\u50cf\u539f\u7406<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><img decoding=\"async\" alt=\"CRT \u663e\u793a\u5668\u626b\u63cf\u539f\u7406\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_1-2.png\" \/><\/p>\n<p>\u9996\u5148\u4ece\u8fc7\u53bb\u7684 CRT \u663e\u793a\u5668\u539f\u7406\u8bf4\u8d77\u3002CRT \u7684\u7535\u5b50\u67aa\u6309\u7167\u4e0a\u9762\u65b9\u5f0f\uff0c\u4ece\u4e0a\u5230\u4e0b\u4e00\u884c\u884c\u626b\u63cf\uff0c\u626b\u63cf\u5b8c\u6210\u540e\u663e\u793a\u5668\u5c31\u5448\u73b0\u4e00\u5e27\u753b\u9762\uff0c\u968f\u540e\u7535\u5b50\u67aa\u56de\u5230\u521d\u59cb\u4f4d\u7f6e\u7ee7\u7eed\u4e0b\u4e00\u6b21\u626b\u63cf\u3002\u4e3a\u4e86\u628a\u663e\u793a\u5668\u7684\u663e\u793a\u8fc7\u7a0b\u548c\u7cfb\u7edf\u7684\u89c6\u9891\u63a7\u5236\u5668\u8fdb\u884c\u540c\u6b65\uff0c\u663e\u793a\u5668\uff08\u6216\u8005\u5176\u4ed6\u786c\u4ef6\uff09\u4f1a\u7528\u786c\u4ef6\u65f6\u949f\u4ea7\u751f\u4e00\u7cfb\u5217\u7684\u5b9a\u65f6\u4fe1\u53f7\u3002\u5f53\u7535\u5b50\u67aa\u6362\u5230\u65b0\u7684\u4e00\u884c\uff0c\u51c6\u5907\u8fdb\u884c\u626b\u63cf\u65f6\uff0c\u663e\u793a\u5668\u4f1a\u53d1\u51fa\u4e00\u4e2a\u6c34\u5e73\u540c\u6b65\u4fe1\u53f7\uff08horizonal synchronization\uff09\uff0c\u7b80\u79f0 HSync\uff1b\u800c\u5f53\u4e00\u5e27\u753b\u9762\u7ed8\u5236\u5b8c\u6210\u540e\uff0c\u7535\u5b50\u67aa\u56de\u590d\u5230\u539f\u4f4d\uff0c\u51c6\u5907\u753b\u4e0b\u4e00\u5e27\u524d\uff0c\u663e\u793a\u5668\u4f1a\u53d1\u51fa\u4e00\u4e2a\u5782\u76f4\u540c\u6b65\u4fe1\u53f7\uff08vertical synchronization\uff09\uff0c\u7b80\u79f0 VSync\u3002\u663e\u793a\u5668\u901a\u5e38\u4ee5\u56fa\u5b9a\u9891\u7387\u8fdb\u884c\u5237\u65b0\uff0c\u8fd9\u4e2a\u5237\u65b0\u7387\u5c31\u662f VSync \u4fe1\u53f7\u4ea7\u751f\u7684\u9891\u7387\u3002\u5c3d\u7ba1\u73b0\u5728\u7684\u8bbe\u5907\u5927\u90fd\u662f\u6db2\u6676\u663e\u793a\u5c4f\u4e86\uff0c\u4f46\u539f\u7406\u4ecd\u7136\u6ca1\u6709\u53d8\u3002<\/p>\n<p><img decoding=\"async\" alt=\"CPU\u3001GPU\u3001\u663e\u793a\u5668\u534f\u540c\u5de5\u4f5c\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_2-2.png\" \/><\/p>\n<p>\u901a\u5e38\u6765\u8bf4\uff0c\u8ba1\u7b97\u673a\u7cfb\u7edf\u4e2d CPU\u3001GPU\u3001\u663e\u793a\u5668\u662f\u4ee5\u4e0a\u9762\u8fd9\u79cd\u65b9\u5f0f\u534f\u540c\u5de5\u4f5c\u7684\u3002CPU \u8ba1\u7b97\u597d\u663e\u793a\u5185\u5bb9\u63d0\u4ea4\u5230 GPU\uff0cGPU \u6e32\u67d3\u5b8c\u6210\u540e\u5c06\u6e32\u67d3\u7ed3\u679c\u653e\u5165\u5e27\u7f13\u51b2\u533a\uff0c\u968f\u540e\u89c6\u9891\u63a7\u5236\u5668\u4f1a\u6309\u7167 VSync \u4fe1\u53f7\u9010\u884c\u8bfb\u53d6\u5e27\u7f13\u51b2\u533a\u7684\u6570\u636e\uff0c\u7ecf\u8fc7\u53ef\u80fd\u7684\u6570\u6a21\u8f6c\u6362\u4f20\u9012\u7ed9\u663e\u793a\u5668\u663e\u793a\u3002<\/p>\n<p>\u5728\u6700\u7b80\u5355\u7684\u60c5\u51b5\u4e0b\uff0c\u5e27\u7f13\u51b2\u533a\u53ea\u6709\u4e00\u4e2a\uff0c\u8fd9\u65f6\u5e27\u7f13\u51b2\u533a\u7684\u8bfb\u53d6\u548c\u5237\u65b0\u90fd\u4f1a\u6709\u6bd4\u8f83\u5927\u7684\u6548\u7387\u95ee\u9898\u3002\u4e3a\u4e86\u89e3\u51b3\u6548\u7387\u95ee\u9898\uff0c\u663e\u793a\u7cfb\u7edf\u901a\u5e38\u4f1a\u5f15\u5165\u4e24\u4e2a\u7f13\u51b2\u533a\uff0c\u5373<strong>\u53cc\u7f13\u51b2\u673a\u5236<\/strong>\u3002\u5728\u8fd9\u79cd\u60c5\u51b5\u4e0b\uff0cGPU \u4f1a\u9884\u5148\u6e32\u67d3\u597d\u4e00\u5e27\u653e\u5165\u4e00\u4e2a\u7f13\u51b2\u533a\u5185\uff0c\u8ba9\u89c6\u9891\u63a7\u5236\u5668\u8bfb\u53d6\uff0c\u5f53\u4e0b\u4e00\u5e27\u6e32\u67d3\u597d\u540e\uff0cGPU \u4f1a\u76f4\u63a5\u628a\u89c6\u9891\u63a7\u5236\u5668\u7684\u6307\u9488\u6307\u5411\u7b2c\u4e8c\u4e2a\u7f13\u51b2\u5668\u3002\u5982\u6b64\u4e00\u6765\u6548\u7387\u4f1a\u6709\u5f88\u5927\u7684\u63d0\u5347\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u753b\u9762\u6495\u88c2\u73b0\u8c61\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_3-2.png\" \/><\/p>\n<p>\u53cc\u7f13\u51b2\u867d\u7136\u80fd\u89e3\u51b3\u6548\u7387\u95ee\u9898\uff0c\u4f46\u4f1a\u5f15\u5165\u4e00\u4e2a\u65b0\u7684\u95ee\u9898\u3002\u5f53\u89c6\u9891\u63a7\u5236\u5668\u8fd8\u672a\u8bfb\u53d6\u5b8c\u6210\u65f6\uff0c\u5373\u5c4f\u5e55\u5185\u5bb9\u521a\u663e\u793a\u4e00\u534a\u65f6\uff0cGPU \u5c06\u65b0\u7684\u4e00\u5e27\u5185\u5bb9\u63d0\u4ea4\u5230\u5e27\u7f13\u51b2\u533a\u5e76\u628a\u4e24\u4e2a\u7f13\u51b2\u533a\u8fdb\u884c\u4ea4\u6362\u540e\uff0c\u89c6\u9891\u63a7\u5236\u5668\u5c31\u4f1a\u628a\u65b0\u7684\u4e00\u5e27\u6570\u636e\u7684\u4e0b\u534a\u6bb5\u663e\u793a\u5230\u5c4f\u5e55\u4e0a\uff0c\u9020\u6210<strong>\u753b\u9762\u6495\u88c2\u73b0\u8c61<\/strong>\uff0c\u5982\u4e0b\u56fe\uff1a<\/p>\n<p>\u4e3a\u4e86\u89e3\u51b3\u8fd9\u4e2a\u95ee\u9898\uff0cGPU \u901a\u5e38\u6709\u4e00\u4e2a\u673a\u5236\u53eb\u505a<strong>\u5782\u76f4\u540c\u6b65<\/strong>\uff08\u7b80\u5199\u4e5f\u662f V-Sync\uff09\uff0c\u5f53\u5f00\u542f\u5782\u76f4\u540c\u6b65\u540e\uff0cGPU \u4f1a\u7b49\u5f85\u663e\u793a\u5668\u7684 VSync \u4fe1\u53f7\u53d1\u51fa\u540e\uff0c\u624d\u8fdb\u884c\u65b0\u7684\u4e00\u5e27\u6e32\u67d3\u548c\u7f13\u51b2\u533a\u66f4\u65b0\u3002\u8fd9\u6837\u80fd\u89e3\u51b3\u753b\u9762\u6495\u88c2\u73b0\u8c61\uff0c\u4e5f\u589e\u52a0\u4e86\u753b\u9762\u6d41\u7545\u5ea6\uff0c\u4f46\u9700\u8981\u6d88\u8d39\u66f4\u591a\u7684\u8ba1\u7b97\u8d44\u6e90\uff0c\u4e5f\u4f1a\u5e26\u6765\u90e8\u5206\u5ef6\u8fdf\u3002<\/p>\n<p>\u90a3\u4e48\u76ee\u524d\u4e3b\u6d41\u7684\u79fb\u52a8\u8bbe\u5907\u662f\u4ec0\u4e48\u60c5\u51b5\u5462\uff1f\u4ece\u7f51\u4e0a\u67e5\u5230\u7684\u8d44\u6599\u53ef\u4ee5\u77e5\u9053\uff0c<strong>iOS \u8bbe\u5907\u4f1a\u59cb\u7ec8\u4f7f\u7528\u53cc\u7f13\u5b58\uff0c\u5e76\u5f00\u542f\u5782\u76f4\u540c\u6b65<\/strong>\u3002\u800c\u5b89\u5353\u8bbe\u5907\u76f4\u5230 4.1 \u7248\u672c\uff0cGoogle \u624d\u5f00\u59cb\u5f15\u5165\u8fd9\u79cd\u673a\u5236\uff0c\u76ee\u524d\u5b89\u5353\u7cfb\u7edf\u662f\u4e09\u7f13\u5b58+\u5782\u76f4\u540c\u6b65\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"12_%E5%8D%A1%E9%A1%BF%E4%BA%A7%E7%94%9F%E7%9A%84%E5%8E%9F%E5%9B%A0\"><\/span>1.2 \u5361\u987f\u4ea7\u751f\u7684\u539f\u56e0<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><img decoding=\"async\" alt=\"\u5361\u987f\u4ea7\u751f\u539f\u7406\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_4-2.png\" \/><\/p>\n<p>\u5728 VSync \u4fe1\u53f7\u5230\u6765\u540e\uff0c\u7cfb\u7edf\u56fe\u5f62\u670d\u52a1\u4f1a\u901a\u8fc7 CADisplayLink \u7b49\u673a\u5236\u901a\u77e5 App\uff0cApp \u4e3b\u7ebf\u7a0b\u5f00\u59cb\u5728 CPU \u4e2d\u8ba1\u7b97\u663e\u793a\u5185\u5bb9\uff0c\u6bd4\u5982\u89c6\u56fe\u7684\u521b\u5efa\u3001\u5e03\u5c40\u8ba1\u7b97\u3001\u56fe\u7247\u89e3\u7801\u3001\u6587\u672c\u7ed8\u5236\u7b49\u3002\u968f\u540e CPU \u4f1a\u5c06\u8ba1\u7b97\u597d\u7684\u5185\u5bb9\u63d0\u4ea4\u5230 GPU \u53bb\uff0c\u7531 GPU \u8fdb\u884c\u53d8\u6362\u3001\u5408\u6210\u3001\u6e32\u67d3\u3002\u968f\u540e GPU \u4f1a\u628a\u6e32\u67d3\u7ed3\u679c\u63d0\u4ea4\u5230\u5e27\u7f13\u51b2\u533a\u53bb\uff0c\u7b49\u5f85\u4e0b\u4e00\u6b21 VSync \u4fe1\u53f7\u5230\u6765\u65f6\u663e\u793a\u5230\u5c4f\u5e55\u4e0a\u3002<\/p>\n<p>\u7531\u4e8e\u5782\u76f4\u540c\u6b65\u7684\u673a\u5236\uff0c\u5982\u679c\u5728\u4e00\u4e2a VSync \u65f6\u95f4\u5185\uff0cCPU \u6216\u8005 GPU \u6ca1\u6709\u5b8c\u6210\u5185\u5bb9\u63d0\u4ea4\uff0c\u5219\u90a3\u4e00\u5e27\u5c31\u4f1a\u88ab\u4e22\u5f03\uff0c\u7b49\u5f85\u4e0b\u4e00\u6b21\u673a\u4f1a\u518d\u663e\u793a\uff0c\u800c\u8fd9\u65f6\u663e\u793a\u5c4f\u4f1a\u4fdd\u7559\u4e4b\u524d\u7684\u5185\u5bb9\u4e0d\u53d8\u3002<strong>\u8fd9\u5c31\u662f\u754c\u9762\u5361\u987f\u7684\u539f\u56e0<\/strong>\u3002<\/p>\n<p>\u4ece\u4e0a\u9762\u7684\u56fe\u4e2d\u53ef\u4ee5\u770b\u5230\uff0cCPU \u548c GPU \u4e0d\u8bba\u54ea\u4e2a\u963b\u788d\u4e86\u663e\u793a\u6d41\u7a0b\uff0c\u90fd\u4f1a\u9020\u6210\u6389\u5e27\u73b0\u8c61\u3002\u6240\u4ee5\u5f00\u53d1\u65f6\uff0c\u4e5f\u9700\u8981\u5206\u522b\u5bf9 CPU \u548c GPU \u538b\u529b\u8fdb\u884c\u8bc4\u4f30\u548c\u4f18\u5316\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"13_iOS_%E6%B8%B2%E6%9F%93%E5%BE%AA%E7%8E%AF\"><\/span>1.3 iOS \u6e32\u67d3\u5faa\u73af<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><img decoding=\"async\" alt=\"iOS \u6e32\u67d3\u5faa\u73af\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_5.png\" \/><\/p>\n<p>\u6e32\u67d3\u5faa\u73af\u662f\u4e00\u4e2a\u8fde\u7eed\u6027\u7684\u8fc7\u7a0b\u3002\u901a\u8fc7\u89e6\u78b0\u4e8b\u4ef6\u4f20\u9001\u7ed9 app\uff0c\u7136\u540e\u8f6c\u5316\u5230\u7528\u6237\u754c\u9762\uff0c\u5411\u64cd\u4f5c\u7cfb\u7edf\u4f20\u9001\u3002\u6700\u7ec8\u5448\u73b0\u7ed9\u7528\u6237\uff0c\u8fd9\u5c31\u662f\u5faa\u73af\uff0c\u968f\u7740\u8bbe\u5907\u7684\u5237\u65b0\u7387\u53d1\u751f\u3002<\/p>\n<p><img decoding=\"async\" alt=\"VSync \u4fe1\u53f7\u9891\u7387\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_6.png\" \/><\/p>\n<p>\u5728 iPhone \u548c iPad \u4e2d\uff0cVSync \u4fe1\u53f7\u7684\u9891\u7387\u4e3a 60Hz\uff0c\u5728 iPad Pro \u4e2d\u4e3a 120Hz\u3002\u6211\u4eec\u4ee5 iPhone \u4e3a\u4f8b\uff0c\u8fd9\u610f\u5473\u7740\u6bcf 16.67 \u6beb\u79d2\uff08\u6216\u8005 8.34ms\uff09\uff0c\u5c31\u53ef\u4ee5\u663e\u793a\u4e00\u4e2a\u65b0\u5e27\u3002<\/p>\n<p>\u6574\u4e2a\u6e32\u67d3\u5faa\u73af\u7531\u4e94\u4e2a\u9636\u6bb5\u7ec4\u6210\uff1a<strong>\u4e8b\u4ef6\u9636\u6bb5(Event)<\/strong>\u3001<strong>\u63d0\u4ea4\u9636\u6bb5<\/strong>\u3001<strong>\u6e32\u67d3\u51c6\u5907<\/strong>\u3001<strong>\u6e32\u67d3\u6267\u884c<\/strong>\u3001<strong>\u5c55\u793a\u9636\u6bb5<\/strong>\u3002<\/p>\n<p>\u5728\u63d0\u4ea4\u6216\u6e32\u67d3\u6216\u5c55\u793a\u9636\u6bb5\uff0c\u5982\u679c\u82b1\u8d39\u7684\u65f6\u95f4\u8d85\u8fc7\u4e00\u5e27\uff0c\u5c31\u4f1a\u9020\u6210\u5361\u987f\u3002<\/p>\n<h4><span class=\"ez-toc-section\" id=\"131_%E4%BA%8B%E4%BB%B6%E5%87%86%E5%A4%87\"><\/span>1.3.1 \u4e8b\u4ef6\u51c6\u5907<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u5728\u8fd9\u4e2a\u9636\u6bb5\uff0cApp \u5904\u7406\u89e6\u78b0\u4e8b\u4ef6\u6216\u8005 Timer \u7b49\u5176\u4ed6\u4e8b\u4ef6\uff0c\u51b3\u5b9a\u662f\u5426\u9700\u8981\u6539\u53d8 View \u7684 backgroundColor\u3001frame \u7b49\u5c5e\u6027\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u4e8b\u4ef6\u51c6\u5907\u9636\u6bb5\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_7.png\" \/><\/p>\n<p><img decoding=\"async\" alt=\"\u4e8b\u4ef6\u51c6\u5907\u793a\u4f8b\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_8.png\" \/><\/p>\n<h4><span class=\"ez-toc-section\" id=\"132_%E6%8F%90%E4%BA%A4%E9%98%B6%E6%AE%B5\"><\/span>1.3.2 \u63d0\u4ea4\u9636\u6bb5<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u5728\u4e8b\u4ef6\u51c6\u5907\u4e4b\u540e\u7684\u4e0b\u4e00\u4e2a\u6e32\u67d3\u5faa\u73af\uff0c\u7cfb\u7edf\u8bb0\u5f55\u8fd9\u4e9b\u5b50\u89c6\u56fe\u5c06\u9700\u8981\u67d0\u4e2a\u5e03\u5c40\u6216\u663e\u793a\uff0c\u5728\u63d0\u4ea4\u4e8b\u52a1\u65f6\uff0c\u8fd9\u4e9b\u9700\u8981\u67d0\u4e2a\u663e\u793a\u6216\u5e03\u5c40\u7684\u89c6\u56fe\uff0c\u4f1a\u901a\u8fc7\u8c03\u7528 <code>drawRect<\/code> \u6216 <code>layoutSubviews<\/code> \u6765\u8fdb\u884c\u76f8\u5e94\u7684\u66f4\u65b0\u3002\u66f4\u65b0\u4e4b\u540e\uff0capp \u5411\u6e32\u67d3\u670d\u52a1\u5668\u63d0\u4ea4\u6e32\u67d3\u547d\u4ee4\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u63d0\u4ea4\u9636\u6bb5\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_9.png\" \/><\/p>\n<p><img decoding=\"async\" alt=\"\u63d0\u4ea4\u4e8b\u52a1\u6b65\u9aa4\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_10.png\" \/><\/p>\n<p>\u63d0\u4ea4\u4e8b\u52a1\u7684 4 \u4e2a\u6b65\u9aa4\uff1a<strong>Layout(\u5e03\u5c40)<\/strong>\u3001<strong>Display(\u5c55\u793a)<\/strong>\u3001<strong>Prepare(\u7b79\u5907)<\/strong>\u3001<strong>Commit(\u63d0\u4ea4)<\/strong>\u3002<\/p>\n<p><strong>Layout(\u5e03\u5c40\u9636\u6bb5)<\/strong><\/p>\n<p><code>layoutSubviews<\/code> \u5728 view \u9700\u8981\u5e03\u5c40\u7684\u65f6\u5019\u4f1a\u8c03\u7528\uff0c\u4ee5\u4e0b\u60c5\u51b5\u9700\u8981\u91cd\u65b0\u5e03\u5c40\uff1a<\/p>\n<ul>\n<li>Positioning views(\u4f4d\u7f6e\u6539\u53d8)\uff0c\u4f8b\u5982\uff0cframe\u3001bounds\u3001transform \u5c5e\u6027\u6539\u53d8\uff0c\u4f1a\u91cd\u65b0\u5e03\u5c40<\/li>\n<li>\u6dfb\u52a0\u6216\u8005\u5220\u9664 view<\/li>\n<li>\u663e\u793a\u8c03\u7528 <code>setNeedsLayout()<\/code><\/li>\n<\/ul>\n<p><strong>Display(\u5c55\u793a\u9636\u6bb5)<\/strong><\/p>\n<p>\u9700\u8981\u66f4\u65b0\u5185\u5bb9\u7684\u89c6\u56fe\uff0c\u90fd\u4f1a\u8c03\u7528 <code>draw(rect:)<\/code> \u65b9\u6cd5\u3002\u4ee5\u4e0b\u60c5\u51b5\u4f1a\u8c03\u7528 <code>draw(rect:)<\/code> \u65b9\u6cd5\uff1a<\/p>\n<ul>\n<li>\u6dfb\u52a0\u4e86\u91cd\u5199 <code>draw(rect:)<\/code> \u65b9\u6cd5\u7684\u89c6\u56fe<\/li>\n<li>\u76f4\u63a5\u8c03\u7528\u4e86 <code>setNeedsDisplay()<\/code> \u65b9\u6cd5\uff0c\u4ee5\u8868\u660e\u9700\u8981\u5c55\u793a<\/li>\n<\/ul>\n<p><strong>Prepare(\u7b79\u5907\u9636\u6bb5)<\/strong><\/p>\n<ul>\n<li>\u5bf9\u672a\u89e3\u7801\u7684\u56fe\u7247\uff0c\u8fdb\u884c\u89e3\u7801<\/li>\n<li>\u82e5\u67d0\u4e2a\u56fe\u50cf\u7684\u989c\u8272\u683c\u5f0f\u56fe\u5f62\u5904\u7406\u5668\u65e0\u6cd5\u76f4\u63a5\u4f7f\u7528\uff0c\u5c06\u4f1a\u8fdb\u884c\u8f6c\u6362\uff0c\u8fd9\u6837\u4f1a\u6d88\u8017\u5f88\u591a\u7684\u5185\u5b58<\/li>\n<\/ul>\n<p><strong>Commit (\u63d0\u4ea4\u9636\u6bb5)<\/strong><\/p>\n<ul>\n<li>\u89c6\u56fe\u5c42\u6b21\u7ed3\u6784\u5c06\u88ab\u9012\u5f52\u6253\u5305\uff0c\u5e76\u901a\u8fc7 IPC \u53d1\u9001\u5230\u6e32\u67d3\u670d\u52a1\u5668<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"133_%E6%B8%B2%E6%9F%93%E5%87%86%E5%A4%87\"><\/span>1.3.3 \u6e32\u67d3\u51c6\u5907<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u901a\u8fc7\u7ed8\u5236\u4e00\u4e2a\u6709\u9634\u5f71\u7684\u793a\u4f8b\uff0c\u6765\u8bb2\u89e3\u4e0b\u7ed8\u5236\u8fc7\u7a0b\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u6e32\u67d3\u51c6\u5907\u9636\u6bb5\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_11.png\" \/><\/p>\n<p>\u5728\u6e32\u67d3\u51c6\u5907\u9636\u6bb5\uff0c\u6e32\u67d3\u670d\u52a1\u5668\u4f1a\u9010\u5c42\u7f16\u8bd1\u4e00\u7cfb\u5217\u7ed8\u56fe\u547d\u4ee4\uff0c\u4f7f GPU \u80fd\u4ece\u540e\u5411\u524d\u7ed8\u5236\u7528\u6237\u754c\u9762\u3002<\/p>\n<p>\u6e32\u67d3\u670d\u52a1\u5668\u4f7f\u7528\u4e2d\u5e8f\u904d\u5386\u6e32\u67d3\u6574\u4e2a\u7ba1\u9053\uff0c\u5148\u6e32\u67d3\u6839\u8282\u70b9\uff0c\u7136\u540e\u6e32\u67d3\u5de6\u8282\u70b9\uff0c\u7136\u540e\u6e32\u67d3\u53f3\u8282\u70b9\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u6e32\u67d3\u7ba1\u9053\u904d\u5386\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_12.png\" \/><\/p>\n<h4><span class=\"ez-toc-section\" id=\"134_%E6%B8%B2%E6%9F%93%E6%89%A7%E8%A1%8C\"><\/span>1.3.4 \u6e32\u67d3\u6267\u884c<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><img decoding=\"async\" alt=\"\u6e32\u67d3\u6267\u884c\u9636\u6bb5\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_13.png\" \/><\/p>\n<p>\u5728\u6e32\u67d3\u6267\u884c\u9636\u6bb5\uff0c\u6309\u7167\u8fd9\u4e2a\u7ba1\u9053\u7684\u987a\u5e8f\u8fdb\u884c\u7ed8\u5236\uff1a<\/p>\n<ul>\n<li>\u5148\u7ed8\u5236\u84dd\u8272<\/li>\n<li>\u7ed8\u5236\u6df1\u84dd\u8272<\/li>\n<li>\u7ed8\u5236\u9634\u5f71<\/li>\n<\/ul>\n<p>\u9634\u5f71\u7684\u5f62\u72b6\u7531\u5b83\u4e0b\u9762\u7684\u4e24\u4e2a\u5c42\u5b9a\u4e49\uff0c\u56e0\u6b64 GPU \u4e0d\u77e5\u9053\u7528\u4ec0\u4e48\u5f62\u72b6\u6765\u7ed8\u5236\u9634\u5f71\uff0c\u4f46\u5982\u679c\u5148\u7ed8\u5236\u5706\u5f62\u548c\u957f\u6761\uff0c\u90a3\u4e48\u9634\u5f71\u4f1a\u7528\u9ed1\u8272\u906e\u6321\u5b83\u4eec\uff0c\u770b\u8d77\u6765\u4f1a\u4e0d\u6b63\u786e\uff0c\u6b64\u65f6\uff0cGPU \u5fc5\u987b\u5207\u6362\u5230\u4e0d\u540c\u7684\u7eb9\u7406\uff0c\u4ee5\u786e\u5b9a\u9634\u5f71\u7684\u5f62\u72b6\uff0c\u8fd9\u79cd\u60c5\u51b5\uff0c\u6211\u4eec\u79f0\u4e4b\u4e3a<strong>\u79bb\u5c4f\u6e32\u67d3<\/strong>\uff0c\u5728\u65b0\u5f00\u8f9f\u7684\u7eb9\u7406\u4e2d\uff0c\u52a0\u4e0b\u9762\u7684\u5c42\u590d\u5236\u8fc7\u6765\uff0c\u786e\u5b9a\u9634\u5f71\u7684\u5f62\u72b6\uff0c\u9634\u5f71\u6e32\u67d3\u5b8c\u6210\u540e\uff0c\u5c06\u90a3\u4e2a\u79bb\u5c4f\u7eb9\u7406\u590d\u5236\u5230\u6700\u7ec8\u7eb9\u7406\u4e2d\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u79bb\u5c4f\u6e32\u67d3\u793a\u4f8b\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_14.png\" \/><\/p>\n<p><strong>\u79bb\u5c4f\u6e32\u67d3<\/strong>\uff1aGPU \u5148\u5728\u5176\u4ed6\u5730\u65b9\u6e32\u67d3\u4e00\u4e2a\u56fe\u5c42\uff0c\u7136\u540e\u518d\u5c06\u5176\u590d\u5236\u8fc7\u6765\uff0c\u6211\u4eec\u79f0\u4e4b\u4e3a<strong>\u79bb\u5c4f\u901a\u9053\uff08Offscreen Pass\uff09<\/strong>\u3002<\/p>\n<ul>\n<li>\u7ed8\u5236\u5706\u5f62\u548c\u957f\u65b9\u5f62\u548c\u6587\u5b57<\/li>\n<\/ul>\n<p><img decoding=\"async\" alt=\"\u6700\u7ec8\u6e32\u67d3\u7ed3\u679c\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_15.png\" \/><\/p>\n<h4><span class=\"ez-toc-section\" id=\"135_%E5%B1%95%E7%A4%BA%E9%98%B6%E6%AE%B5\"><\/span>1.3.5 \u5c55\u793a\u9636\u6bb5<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u5c55\u793a\u9636\u6bb5\u5c06\u6e32\u67d3\u597d\u7684\u5185\u5bb9\u663e\u793a\u5230\u5c4f\u5e55\u4e0a\uff0c\u5b8c\u6210\u6574\u4e2a\u6e32\u67d3\u5faa\u73af\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"14_App_%E5%8D%A1%E9%A1%BF%E7%AD%89%E7%BA%A7_%E2%80%93_%E5%8D%A1%E9%A1%BF%E6%97%B6%E9%97%B4%E6%AF%94\"><\/span>1.4 App \u5361\u987f\u7b49\u7ea7 &#8211; \u5361\u987f\u65f6\u95f4\u6bd4<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><strong>\u5361\u987f\u65f6\u95f4\u6bd4 = \u5361\u987f\u65f6\u957f \/ \u8fd0\u884c\u65f6\u95f4<\/strong><\/p>\n<p>\u5728 Apple \u7684\u5b98\u65b9\u5efa\u8bae\u4e2d\uff0c\u4f7f\u7528\u5361\u987f\u65f6\u95f4\u6bd4\u6765\u8861\u91cf\u5361\u987f\u7684\u4e25\u91cd\u7b49\u7ea7\u3002\u5361\u987f\u65f6\u95f4\u6bd4\u5927\u4e8e\u7b49\u4e8e 1% \u5373\u5c5e\u4e8e\u4e25\u91cd\u5361\u987f\uff0c0.5%~1% \u5c5e\u4e8e\u8b66\u544a\u5361\u987f\uff0c\u5c0f\u4e8e 0.5% \u5c5e\u4e8e\u8fd0\u884c\u6d41\u7545\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u5361\u987f\u65f6\u95f4\u6bd4\u7b49\u7ea7\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_16.png\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"15_%E6%93%8D%E4%BD%9C%E5%8D%A1%E9%A1%BF%E7%AD%89%E7%BA%A7\"><\/span>1.5 \u64cd\u4f5c\u5361\u987f\u7b49\u7ea7<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u64cd\u4f5c\u7684\u5361\u987f\u7b49\u7ea7\u6839\u636e\u5361\u987f\u963b\u585e\u65f6\u95f4\u7684\u957f\u77ed\u8fdb\u884c\u4e86 3 \u4e2a\u7b49\u7ea7\u7684\u5212\u5206\uff1a<\/p>\n<p><img decoding=\"async\" alt=\"\u64cd\u4f5c\u5361\u987f\u7b49\u7ea7\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_17.png\" \/><\/p>\n<ol>\n<li><strong>\u4e22\u5e27<\/strong>\uff1a\u52a8\u753b\u3001\u6ed1\u52a8\u5217\u8868\u4e0d\u6d41\u7545\uff0c\u4e00\u822c\u4e3a\u5341\u51e0\u81f3\u51e0\u5341\u6beb\u79d2\u7684\u7ea7\u522b<\/li>\n<li><strong>\u5361\u987f<\/strong>\uff1a\u77ed\u65f6\u95f4\u64cd\u4f5c\u65e0\u53cd\u5e94\uff0c\u6062\u590d\u540e\u80fd\u7ee7\u7eed\u4f7f\u7528\uff0c\u4ece\u51e0\u767e\u6beb\u79d2\u81f3\u51e0\u79d2\uff0c\u6682\u5b9a 400ms<\/li>\n<li><strong>\u5361\u6b7b<\/strong>\uff1a\u957f\u65f6\u95f4\u65e0\u53cd\u5e94\uff0c\u76f4\u81f3\u88ab\u7cfb\u7edf\u6740\u6b7b\uff0c\u901a\u8fc7\u7ebf\u4e0a\u6536\u96c6\u6570\u636e\uff0c\u6700\u5c11\u4e3a 5s<\/li>\n<\/ol>\n<p>\u5176\u4e2d\u5361\u6b7b\u662f\u6700\u635f\u5bb3\u7528\u6237\u4f53\u9a8c\u7684\uff0c\u56e0\u4e3a\u5361\u6b7b\u4e0d\u4ec5\u4ec5\u9020\u6210\u4e86\u7c7b\u4f3c\u4e8e\u5d29\u6e83\u7684\u95ea\u9000\uff0capp \u5728\u76f8\u5f53\u957f\u7684\u4e00\u6bb5\u65f6\u95f4\u5bf9\u7528\u6237\u8fd8\u662f\u4e0d\u53ef\u7528\u7684\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E4%BA%8C%E3%80%81%E7%BA%BF%E4%B8%8B%E7%9B%91%E6%8E%A7%E6%96%B9%E6%A1%88\"><\/span>\u4e8c\u3001\u7ebf\u4e0b\u76d1\u63a7\u65b9\u6848<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>\u4f7f\u7528\u771f\u673a\uff0c\u53d1\u5e03\u7248\u672c\u8fdb\u884c\u5361\u987f\u68c0\u6d4b\uff0c\u6700\u597d\u9009\u7528\u4f4e\u7aef\u673a\u578b\uff0c\u8fd9\u6837\u6bd4\u8f83\u5bb9\u6613\u53d1\u73b0\u95ee\u9898\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"21_Xcode\"><\/span>2.1 Xcode<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"211_%E6%B8%B2%E6%9F%93%E9%80%89%E9%A1%B9\"><\/span>2.1.1 \u6e32\u67d3\u9009\u9879<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u4f7f\u7528\u65b9\u5f0f\uff1a<code>Xcode -&gt; Debug -&gt; View Debugging -&gt; Rendering<\/code><\/p>\n<ul>\n<li>\n<p><strong>Color Blended Layers<\/strong> &#8211; \u8fd9\u4e2a\u9009\u9879\u57fa\u4e8e\u6e32\u67d3\u7a0b\u5ea6\u5bf9\u5c4f\u5e55\u4e2d\u7684\u6df7\u5408\u533a\u57df\u8fdb\u884c\u7eff\u5230\u7ea2\u7684\u9ad8\u4eae\uff08\u4e5f\u5c31\u662f\u591a\u4e2a\u534a\u900f\u660e\u56fe\u5c42\u7684\u53e0\u52a0\uff09\u3002\u7531\u4e8e\u91cd\u7ed8\u7684\u539f\u56e0\uff0c\u6df7\u5408\u5bf9 GPU \u6027\u80fd\u4f1a\u6709\u5f71\u54cd\uff0c\u540c\u65f6\u4e5f\u662f\u6ed1\u52a8\u6216\u8005\u52a8\u753b\u5e27\u7387\u4e0b\u964d\u7684\u7f6a\u9b41\u7978\u9996\u4e4b\u4e00\u3002<\/p>\n<\/li>\n<li>\n<p><strong>Color Hits Green and Misses Red<\/strong> &#8211; \u5f53\u4f7f\u7528 <code>shouldRasterize<\/code> \u5c5e\u6027\u7684\u65f6\u5019\uff0c\u8017\u65f6\u7684\u56fe\u5c42\u7ed8\u5236\u4f1a\u88ab\u7f13\u5b58\uff0c\u7136\u540e\u5f53\u505a\u4e00\u4e2a\u7b80\u5355\u7684\u6241\u5e73\u56fe\u7247\u5448\u73b0\u3002\u5f53\u7f13\u5b58\u518d\u751f\u7684\u65f6\u5019\u8fd9\u4e2a\u9009\u9879\u5c31\u7528\u7ea2\u8272\u5bf9\u6805\u683c\u5316\u56fe\u5c42\u8fdb\u884c\u4e86\u9ad8\u4eae\u3002\u5982\u679c\u7f13\u5b58\u9891\u7e41\u518d\u751f\u7684\u8bdd\uff0c\u5c31\u610f\u5473\u7740\u6805\u683c\u5316\u53ef\u80fd\u4f1a\u6709\u8d1f\u9762\u7684\u6027\u80fd\u5f71\u54cd\u4e86\u3002<\/p>\n<\/li>\n<li>\n<p><strong>Color Copied Images<\/strong> &#8211; \u6709\u65f6\u5019\u5bc4\u5bbf\u56fe\u7247\u7684\u751f\u6210\u610f\u5473\u7740 Core Animation \u88ab\u5f3a\u5236\u751f\u6210\u4e00\u4e9b\u56fe\u7247\uff0c\u7136\u540e\u53d1\u9001\u5230\u6e32\u67d3\u670d\u52a1\u5668\uff0c\u800c\u4e0d\u662f\u7b80\u5355\u7684\u6307\u5411\u539f\u59cb\u6307\u9488\u3002\u8fd9\u4e2a\u9009\u9879\u628a\u8fd9\u4e9b\u56fe\u7247\u6e32\u67d3\u6210\u84dd\u8272\u3002\u590d\u5236\u56fe\u7247\u5bf9\u5185\u5b58\u548c CPU \u4f7f\u7528\u6765\u8bf4\u90fd\u662f\u4e00\u9879\u975e\u5e38\u6602\u8d35\u7684\u64cd\u4f5c\uff0c\u6240\u4ee5\u5e94\u8be5\u5c3d\u53ef\u80fd\u7684\u907f\u514d\u3002<\/p>\n<\/li>\n<li>\n<p><strong>Color Immediately<\/strong> &#8211; \u901a\u5e38 Core Animation Instruments \u4ee5\u6bcf\u6beb\u79d2 10 \u6b21\u7684\u9891\u7387\u66f4\u65b0\u56fe\u5c42\u8c03\u8bd5\u989c\u8272\u3002\u5bf9\u67d0\u4e9b\u6548\u679c\u6765\u8bf4\uff0c\u8fd9\u663e\u7136\u592a\u6162\u4e86\u3002\u8fd9\u4e2a\u9009\u9879\u5c31\u53ef\u4ee5\u7528\u6765\u8bbe\u7f6e\u6bcf\u5e27\u90fd\u66f4\u65b0\uff08\u53ef\u80fd\u4f1a\u5f71\u54cd\u5230\u6e32\u67d3\u6027\u80fd\uff0c\u800c\u4e14\u4f1a\u5bfc\u81f4\u5e27\u7387\u6d4b\u91cf\u4e0d\u51c6\uff0c\u6240\u4ee5\u4e0d\u8981\u4e00\u76f4\u90fd\u8bbe\u7f6e\u5b83\uff09\u3002<\/p>\n<\/li>\n<li>\n<p><strong>Color Misaligned Images<\/strong> &#8211; \u8fd9\u91cc\u4f1a\u9ad8\u4eae\u90a3\u4e9b\u88ab\u7f29\u653e\u6216\u8005\u62c9\u4f38\u4ee5\u53ca\u6ca1\u6709\u6b63\u786e\u5bf9\u9f50\u5230\u50cf\u7d20\u8fb9\u754c\u7684\u56fe\u7247\uff08\u4e5f\u5c31\u662f\u975e\u6574\u578b\u5750\u6807\uff09\u3002\u8fd9\u4e9b\u4e2d\u7684\u5927\u591a\u6570\u901a\u5e38\u90fd\u4f1a\u5bfc\u81f4\u56fe\u7247\u7684\u4e0d\u6b63\u5e38\u7f29\u653e\uff0c\u5982\u679c\u628a\u4e00\u5f20\u5927\u56fe\u5f53\u7f29\u7565\u56fe\u663e\u793a\uff0c\u6216\u8005\u4e0d\u6b63\u786e\u5730\u6a21\u7cca\u56fe\u50cf\uff0c\u90a3\u4e48\u8fd9\u4e2a\u9009\u9879\u5c06\u4f1a\u5e2e\u4f60\u8bc6\u522b\u51fa\u95ee\u9898\u6240\u5728\u3002<\/p>\n<\/li>\n<li>\n<p><strong>Color Offscreen-Rendered Yellow<\/strong> &#8211; \u8fd9\u91cc\u4f1a\u628a\u90a3\u4e9b\u9700\u8981\u79bb\u5c4f\u6e32\u67d3\u7684\u56fe\u5c42\u9ad8\u4eae\u6210\u9ec4\u8272\u3002\u8fd9\u4e9b\u56fe\u5c42\u5f88\u53ef\u80fd\u9700\u8981\u7528 <code>shadowPath<\/code> \u6216\u8005 <code>shouldRasterize<\/code> \u6765\u4f18\u5316\u3002<\/p>\n<\/li>\n<li>\n<p><strong>Color OpenGL Fast Path Blue<\/strong> &#8211; \u8fd9\u4e2a\u9009\u9879\u4f1a\u5bf9\u4efb\u4f55\u76f4\u63a5\u4f7f\u7528 OpenGL \u7ed8\u5236\u7684\u56fe\u5c42\u8fdb\u884c\u9ad8\u4eae\u3002\u5982\u679c\u4ec5\u4ec5\u4f7f\u7528 UIKit \u6216\u8005 Core Animation \u7684 API\uff0c\u90a3\u4e48\u4e0d\u4f1a\u6709\u4efb\u4f55\u6548\u679c\u3002\u5982\u679c\u4f7f\u7528 GLKView \u6216\u8005 CAEAGLLayer\uff0c\u90a3\u5982\u679c\u4e0d\u663e\u793a\u84dd\u8272\u5757\u7684\u8bdd\u5c31\u610f\u5473\u7740\u4f60\u6b63\u5728\u5f3a\u5236 CPU \u6e32\u67d3\u989d\u5916\u7684\u7eb9\u7406\uff0c\u800c\u4e0d\u662f\u7ed8\u5236\u5230\u5c4f\u5e55\u3002<\/p>\n<\/li>\n<li>\n<p><strong>Flash Updated Regions<\/strong> &#8211; \u8fd9\u4e2a\u9009\u9879\u4f1a\u5bf9\u91cd\u7ed8\u7684\u5185\u5bb9\u9ad8\u4eae\u6210\u9ec4\u8272\uff08\u4e5f\u5c31\u662f\u4efb\u4f55\u5728\u8f6f\u4ef6\u5c42\u9762\u4f7f\u7528 Core Graphics \u7ed8\u5236\u7684\u56fe\u5c42\uff09\u3002\u8fd9\u79cd\u7ed8\u56fe\u7684\u901f\u5ea6\u5f88\u6162\u3002\u5982\u679c\u9891\u7e41\u53d1\u751f\u8fd9\u79cd\u60c5\u51b5\u7684\u8bdd\uff0c\u8fd9\u610f\u5473\u7740\u6709\u4e00\u4e2a\u9690\u85cf\u7684 bug \u6216\u8005\u8bf4\u901a\u8fc7\u589e\u52a0\u7f13\u5b58\u6216\u8005\u4f7f\u7528\u66ff\u4ee3\u65b9\u6848\u4f1a\u6709\u63d0\u5347\u6027\u80fd\u7684\u7a7a\u95f4\u3002<\/p>\n<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"212_%E5%85%B6%E5%AE%83\"><\/span>2.1.2 \u5176\u5b83<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li><strong>\u6a21\u62df\u5668\u79bb\u5c4f\u6e32\u67d3\u68c0\u6d4b<\/strong>\uff1a<code>Debug -&gt; Color Off-screen Rendered<\/code><\/li>\n<\/ul>\n<p><img decoding=\"async\" alt=\"Xcode \u79bb\u5c4f\u6e32\u67d3\u68c0\u6d4b\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_18.png\" \/><\/p>\n<ul>\n<li><strong>\u4f18\u5316\u5efa\u8bae<\/strong>\uff1a<code>Debug View Hierarchy<\/code>\uff0c<code>Editor -&gt; Show Optimization Opportunities<\/code>\uff0cXcode \u4f1a\u663e\u793a\u4f18\u5316\u5efa\u8bae<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"22_Instruments\"><\/span>2.2 Instruments<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"221_Animation_Hitches\"><\/span>2.2.1 Animation Hitches<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><img decoding=\"async\" alt=\"Animation Hitches\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_19.png\" \/><\/p>\n<p>Animation Hitches \u662f Xcode Instruments \u4e2d\u7528\u4e8e\u68c0\u6d4b\u52a8\u753b\u5361\u987f\u7684\u5de5\u5177\uff0c\u53ef\u4ee5\u5e2e\u52a9\u8bc6\u522b\u5bfc\u81f4\u52a8\u753b\u4e0d\u6d41\u7545\u7684\u539f\u56e0\u3002<\/p>\n<h4><span class=\"ez-toc-section\" id=\"222_OpenGL_ES%EF%BC%88%E5%B7%B2%E5%BA%9F%E5%BC%83%EF%BC%89\"><\/span>2.2.2 OpenGL ES\uff08\u5df2\u5e9f\u5f03\uff09<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u4fa7\u680f\u7684\u53f3\u8fb9\u662f\u4e00\u7cfb\u5217\u6709\u7528\u7684\u5de5\u5177\u3002\u5176\u4e2d\u548c Core Animation \u6027\u80fd\u6700\u76f8\u5173\u7684\u662f\u5982\u4e0b\u51e0\u70b9\uff1a<\/p>\n<ul>\n<li>\n<p><strong>Renderer Utilization<\/strong> &#8211; \u5982\u679c\u8fd9\u4e2a\u503c\u8d85\u8fc7\u4e86 ~50%\uff0c\u5c31\u610f\u5473\u7740\u4f60\u7684\u52a8\u753b\u53ef\u80fd\u5bf9\u5e27\u7387\u6709\u6240\u9650\u5236\uff0c\u5f88\u53ef\u80fd\u56e0\u4e3a\u79bb\u5c4f\u6e32\u67d3\u6216\u8005\u662f\u91cd\u7ed8\u5bfc\u81f4\u7684\u8fc7\u5ea6\u6df7\u5408\u3002<\/p>\n<\/li>\n<li>\n<p><strong>Tiler Utilization<\/strong> &#8211; \u5982\u679c\u8fd9\u4e2a\u503c\u8d85\u8fc7\u4e86 ~50%\uff0c\u5c31\u610f\u5473\u7740\u4f60\u7684\u52a8\u753b\u53ef\u80fd\u9650\u5236\u4e8e\u51e0\u4f55\u7ed3\u6784\u65b9\u9762\uff0c\u4e5f\u5c31\u662f\u5728\u5c4f\u5e55\u4e0a\u6709\u592a\u591a\u7684\u56fe\u5c42\u5360\u7528\u4e86\u3002<\/p>\n<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"%E4%B8%89%E3%80%81%E7%BA%BF%E4%B8%8A%E7%9B%91%E6%8E%A7%E6%96%B9%E6%A1%88\"><\/span>\u4e09\u3001\u7ebf\u4e0a\u76d1\u63a7\u65b9\u6848<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<p>iOS \u4e2d\u7684 3 \u79cd\u5361\u987f\u68c0\u6d4b\u65b9\u6848\uff1a<\/p>\n<h3><span class=\"ez-toc-section\" id=\"31_%E7%9B%91%E6%8E%A7_FPS\"><\/span>3.1 \u76d1\u63a7 FPS<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u4e00\u822c\u6765\u8bf4\uff0c\u6211\u4eec\u7ea6\u5b9a 60FPS \u5373\u4e3a\u6d41\u7545\u3002\u90a3\u4e48\u53cd\u8fc7\u6765\uff0c\u5982\u679c App \u5728\u8fd0\u884c\u671f\u95f4\u51fa\u73b0\u4e86\u6389\u5e27\uff0c\u5373\u53ef\u8ba4\u4e3a\u51fa\u73b0\u4e86\u5361\u987f\u3002<\/p>\n<p>\u76d1\u63a7 FPS \u7684\u65b9\u6848\u51e0\u4e4e\u90fd\u662f\u57fa\u4e8e <code>CADisplayLink<\/code> \u5b9e\u73b0\u7684\u3002\u7b80\u5355\u4ecb\u7ecd\u4e00\u4e0b <code>CADisplayLink<\/code>\uff1a<code>CADisplayLink<\/code> \u662f\u4e00\u4e2a\u548c\u5c4f\u5e55\u5237\u65b0\u7387\u4fdd\u6301\u4e00\u81f4\u7684\u5b9a\u65f6\u5668\uff0c\u4e00\u65e6 <code>CADisplayLink<\/code> \u4ee5\u7279\u5b9a\u7684\u6a21\u5f0f\u6ce8\u518c\u5230 runloop \u4e4b\u540e\uff0c\u6bcf\u5f53\u5c4f\u5e55\u9700\u8981\u5237\u65b0\u7684\u65f6\u5019\uff0crunloop \u5c31\u4f1a\u8c03\u7528 <code>CADisplayLink<\/code> \u7ed1\u5b9a\u7684 target \u4e0a\u7684 selector\u3002\u53ef\u4ee5\u901a\u8fc7\u5411 RunLoop \u4e2d\u6dfb\u52a0 <code>CADisplayLink<\/code>\uff0c\u6839\u636e\u5176\u56de\u8c03\u6765\u8ba1\u7b97\u51fa\u5f53\u524d\u753b\u9762\u7684\u5e27\u6570\u3002<\/p>\n<pre><code class=\"language-objective-c\">#import &quot;FPSMonitor.h&quot;\n#import &lt;UIKit\/UIKit.h&gt;\n\n@interface FPSMonitor ()\n@property (nonatomic, strong) CADisplayLink* link;\n@property (nonatomic, assign) NSInteger count;\n@property (nonatomic, assign) NSTimeInterval lastTime;\n@end\n\n@implementation FPSMonitor\n\n- (void)beginMonitor {\n    _link = [CADisplayLink displayLinkWithTarget:self selector:@selector(fpsInfoCaculate:)];\n    [_link addToRunLoop:[NSRunLoop mainRunLoop] forMode:NSRunLoopCommonModes];\n}\n\n- (void)fpsInfoCaculate:(CADisplayLink *)sender {\n    if (_lastTime == 0) {\n        _lastTime = sender.timestamp;\n        return;\n    }\n    _count++;\n    double deltaTime = sender.timestamp - _lastTime;\n    if (deltaTime &gt;= 1) {\n        NSInteger FPS = _count \/ deltaTime;\n        _lastTime = sender.timestamp;\n        _count = 0;\n        NSLog(@&quot;FPS: %li&quot;, (NSInteger)ceil(FPS + 0.5));\n    }\n}\n\n@end\n<\/code><\/pre>\n<p><strong>FPS \u76d1\u63a7\u7684\u4f18\u7f3a\u70b9<\/strong>\uff1a<\/p>\n<ul>\n<li><strong>\u4f18\u70b9<\/strong>\uff1a\u76f4\u89c2\uff0c\u5c0f\u624b\u4e00\u5212\u540e FPS \u4e0b\u964d\u4e86\uff0c\u8bf4\u660e\u9875\u9762\u7684\u67d0\u5904\u6709\u6027\u80fd\u95ee\u9898<\/li>\n<li><strong>\u7f3a\u70b9<\/strong>\uff1a\u53ea\u77e5\u9053\u8fd9\u662f\u9875\u9762\u7684\u67d0\u5904\uff0c\u4e0d\u80fd\u51c6\u786e\u5b9a\u4f4d\u5230\u5177\u4f53\u7684\u5806\u6808<\/li>\n<\/ul>\n<h3><span class=\"ez-toc-section\" id=\"32_%E7%9B%91%E6%8E%A7_RunLoop\"><\/span>3.2 \u76d1\u63a7 RunLoop<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>iOS App \u57fa\u4e8e RunLoop \u6d88\u606f\u5faa\u73af\u673a\u5236\u8fd0\u884c\uff0c\u6709\u6d88\u606f\u65f6\u8fdb\u884c\u5904\u7406\uff0c\u6ca1\u6709\u6d88\u606f\u65f6\u8fdb\u5165\u4f11\u7720\u72b6\u6001\u3002<\/p>\n<p>RunLoop \u540c\u65f6\u63d0\u4f9b\u4e86 6 \u79cd\u8fd0\u884c\u72b6\u6001\u901a\u77e5\u63a5\u53e3\uff0c\u8fd9 6 \u79cd\u72b6\u6001\u5206\u522b\u662f\uff1a<\/p>\n<pre><code class=\"language-objective-c\">typedef CF_OPTIONS(CFOptionFlags, CFRunLoopActivity) {\n    kCFRunLoopEntry = (1UL &lt;&lt; 0),          \/\/ \u5373\u5c06\u8fdb\u5165 RunLoop\n    kCFRunLoopBeforeTimers = (1UL &lt;&lt; 1),   \/\/ \u5373\u5c06\u5904\u7406 Timers\n    kCFRunLoopBeforeSources = (1UL &lt;&lt; 2),  \/\/ \u5373\u5c06\u5904\u7406 Sources\n    kCFRunLoopBeforeWaiting = (1UL &lt;&lt; 5),  \/\/ \u5373\u5c06\u8fdb\u5165\u4f11\u7720\n    kCFRunLoopAfterWaiting = (1UL &lt;&lt; 6),   \/\/ \u521a\u4ece\u4f11\u7720\u4e2d\u5524\u9192\n    kCFRunLoopExit = (1UL &lt;&lt; 7),           \/\/ \u5373\u5c06\u9000\u51fa RunLoop\n    kCFRunLoopAllActivities = 0x0FFFFFFFU  \/\/ \u4ee5\u4e0a\u6240\u6709\u72b6\u6001\n};\n<\/code><\/pre>\n<p>\u6574\u4e2a runloop \u6d88\u606f\u5904\u7406\u6d41\u7a0b\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" alt=\"RunLoop \u6d88\u606f\u5904\u7406\u6d41\u7a0b\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_20.png\" \/><\/p>\n<p>RunLoop \u5728 <code>BeforeSources<\/code> \u548c <code>AfterWaiting<\/code> \u540e\u4f1a\u8fdb\u884c\u4efb\u52a1\u7684\u5904\u7406\u3002\u89c2\u5bdf\u7ebf\u7a0b\u5728\u6536\u5230 runloop \u7ebf\u7a0b\u5904\u4e8e\u8be5\u72b6\u6001\u4e4b\u540e\u8bbe\u7f6e\u8d85\u65f6\u65f6\u95f4\uff0c\u82e5\u8d85\u65f6\u540e RunLoop \u7684\u72b6\u6001\u4ecd\u4e3a <code>BeforeSources<\/code> \u6216 <code>AfterWaiting<\/code>\uff0c\u8868\u660e\u6b64\u65f6 RunLoop \u4ecd\u7136\u5728\u5904\u7406\u4efb\u52a1\uff0c\u4e3b\u7ebf\u7a0b\u53d1\u751f\u4e86\u5361\u987f\u3002<\/p>\n<p>\u53c2\u8003\u76d1\u63a7\u4ee3\u7801\u5982\u4e0b\uff1a<\/p>\n<pre><code class=\"language-objective-c\">- (void)start {\n    if (self.runing) {\n        return;\n    }\n    self.runing = YES;\n    CFIndex order[2] = {0, LONG_MAX};\n    for (int i=0; i&lt;2; ++i) {\n        if (self.ctx[i].ref != NULL) {\n            continue;\n        }\n        __weak typeof(self) weakSelf = self;\n        CFRunLoopObserverRef ref = CFRunLoopObserverCreateWithHandler(\n            kCFAllocatorDefault, \n            kCFRunLoopAllActivities, \n            YES, \n            order[i],\n            ^(CFRunLoopObserverRef observer, CFRunLoopActivity activity) {\n                __strong typeof(self) strongSelf = weakSelf;\n                if (strongSelf != nil) {\n                    if (observer == strongSelf.ctx[0].ref) {\n                        strongSelf.ctx[0].activity = activity;\n                    } else {\n                        strongSelf.ctx[1].activity = activity;\n                    }\n                    dispatch_semaphore_signal(strongSelf.semaphore);\n                }\n            }\n        );\n        CFRunLoopAddObserver(CFRunLoopGetMain(), ref, kCFRunLoopCommonModes);\n        self.ctx[i].ref = ref;\n    }\n\n    [self startCheckHangup];\n    LOG_INFO(&quot;hangup start observer&quot;);\n}\n\n- (void)startCheckHangup {\n    __weak typeof(self) weakSelf = self;\n    dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{\n        LOG_INFO(&quot;hangup start check hangup&quot;);\n        while (YES) {\n            __strong typeof(self) strongSelf = weakSelf;\n            if (strongSelf == nil) {\n                break;\n            }\n            if (!strongSelf.runing) {\n                break;\n            }\n            [strongSelf checkHangup];\n        }\n        LOG_INFO(&quot;hangup stop check hangup&quot;);\n    });\n}\n\n- (void)checkHangup {\n    static CFAbsoluteTime adjustInterval = (float)self.config.checkInterval \/ 1000;\n    dispatch_time_t timeout = dispatch_time(DISPATCH_TIME_NOW, self.config.checkInterval*NSEC_PER_MSEC);\n    long semaphoreWait = dispatch_semaphore_wait(self.semaphore, timeout);\n    if (semaphoreWait != 0) {\n        if (self.ctx[0].activity == kCFRunLoopBeforeSources\n            || self.ctx[0].activity == kCFRunLoopAfterWaiting\n            || self.ctx[1].activity == kCFRunLoopBeforeSources\n            || self.ctx[1].activity == kCFRunLoopAfterWaiting) {\n            \/\/ \u53d1\u751f\u5361\u987f\n            ++self.timeoutCount;\n        }\n    } else if (self.timeoutCount &gt; 0) {\n        \/\/ \u5361\u987f\u7ed3\u675f\n        self.timeoutCount = 0;\n    }\n}\n<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"321_%E9%AB%98%E5%8F%AF%E7%94%A8%E5%8D%A1%E9%A1%BF%E6%A3%80%E6%B5%8B\"><\/span>3.2.1 \u9ad8\u53ef\u7528\u5361\u987f\u68c0\u6d4b<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u5361\u987f\u76d1\u63a7\u6709\u65f6\u4f1a\u51fa\u73b0\u5931\u6548\u7684\u60c5\u51b5\uff0c\u57fa\u672c\u539f\u56e0\u662f\u56e0\u4e3a runloop \u89c2\u5bdf\u8005\u6709\u65f6\u4f1a\u5728\u63a5\u6536\u5230\u4e8b\u4ef6\u901a\u77e5\u7684\u65f6\u5019\uff0c\u505a\u4e00\u4e9b\u989d\u5916\u7684 UI \u64cd\u4f5c\uff0c\u6bd4\u5982 <code>UITableView -tableView:didSelectRowAtIndexPath<\/code> \u51fd\u6570\u5b9e\u73b0\u662f\u5728\u63a5\u6536\u5230 <code>kCFRunLoopBeforeWaiting<\/code> \u901a\u77e5\u4e4b\u540e\u624d\u5f00\u59cb\u6267\u884c\u7684\uff0c\u5982\u679c\u5361\u987f\u76d1\u63a7\u7684\u89c2\u5bdf\u8005\u65e9\u4e8e UITableView \u89c2\u5bdf\u8005\u63a5\u6536\u5230\u8fd9\u4e2a\u901a\u77e5\uff0c\u5c31\u65e0\u6cd5\u68c0\u6d4b\u5230 UITableView \u7684\u5361\u987f\u64cd\u4f5c\u3002<\/p>\n<p>\u9488\u5bf9\u8fd9\u79cd\u573a\u666f\uff0c\u53ef\u4ee5\u901a\u8fc7\u6dfb\u52a0\u4e24\u4e2a runloop \u7684\u5361\u987f\u76d1\u63a7\u89c2\u5bdf\u8005\uff0c\u786e\u4fdd\u4e00\u4e2a\u6700\u5148\u63a5\u6536\u5230\u4e8b\u4ef6\u901a\u77e5\uff0c\u4e00\u4e2a\u6700\u540e\u63a5\u6536\u5230\u4e8b\u4ef6\u901a\u77e5\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u5b8c\u7f8e\u89e3\u51b3\u5361\u987f\u68c0\u6d4b\u6709\u65f6\u5931\u6548\u7684\u95ee\u9898\u3002<\/p>\n<h4><span class=\"ez-toc-section\" id=\"322_Core_Animation_%E8%A7%82%E5%AF%9F%E8%80%85%E6%A8%A1%E5%BC%8F\"><\/span>3.2.2 Core Animation \u89c2\u5bdf\u8005\u6a21\u5f0f<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>Core Animation \u5728 RunLoop \u4e2d\u6ce8\u518c\u4e86\u4e00\u4e2a Observer\uff0c\u76d1\u542c\u4e86 <code>BeforeWaiting<\/code> \u548c <code>Exit<\/code> \u4e8b\u4ef6\u3002\u8fd9\u4e2a Observer \u7684\u4f18\u5148\u7ea7\u662f 2000000\uff0c\u4f4e\u4e8e\u5e38\u89c1\u7684\u5176\u4ed6 Observer\u3002<\/p>\n<p>\u5f53\u4e00\u4e2a\u89e6\u6478\u4e8b\u4ef6\u5230\u6765\u65f6\uff0cRunLoop \u88ab\u5524\u9192\uff0cApp \u4e2d\u7684\u4ee3\u7801\u4f1a\u6267\u884c\u4e00\u4e9b\u64cd\u4f5c\uff0c\u6bd4\u5982\u521b\u5efa\u548c\u8c03\u6574\u89c6\u56fe\u5c42\u7ea7\u3001\u8bbe\u7f6e UIView \u7684 frame\u3001\u4fee\u6539 CALayer \u7684\u900f\u660e\u5ea6\u3001\u4e3a\u89c6\u56fe\u6dfb\u52a0\u4e00\u4e2a\u52a8\u753b\uff1b\u8fd9\u4e9b\u64cd\u4f5c\u6700\u7ec8\u90fd\u4f1a\u88ab CALayer \u6355\u83b7\uff0c\u5e76\u901a\u8fc7 CATransaction \u63d0\u4ea4\u5230\u4e00\u4e2a\u4e2d\u95f4\u72b6\u6001\u53bb\uff08CATransaction \u7684\u6587\u6863\u7565\u6709\u63d0\u5230\u8fd9\u4e9b\u5185\u5bb9\uff0c\u4f46\u5e76\u4e0d\u5b8c\u6574\uff09\u3002<\/p>\n<p>\u5f53\u4e0a\u9762\u6240\u6709\u64cd\u4f5c\u7ed3\u675f\u540e\uff0cRunLoop \u5373\u5c06\u8fdb\u5165\u4f11\u7720\uff08\u6216\u8005\u9000\u51fa\uff09\u65f6\uff0c\u5173\u6ce8\u8be5\u4e8b\u4ef6\u7684 Observer \u90fd\u4f1a\u5f97\u5230\u901a\u77e5\u3002\u8fd9\u65f6 CA \u6ce8\u518c\u7684\u90a3\u4e2a Observer \u5c31\u4f1a\u5728\u56de\u8c03\u4e2d\uff0c\u628a\u6240\u6709\u7684\u4e2d\u95f4\u72b6\u6001\u5408\u5e76\u63d0\u4ea4\u5230 GPU \u53bb\u663e\u793a\uff1b\u5982\u679c\u6b64\u5904\u6709\u52a8\u753b\uff0cCA \u4f1a\u901a\u8fc7 DisplayLink \u7b49\u673a\u5236\u591a\u6b21\u89e6\u53d1\u76f8\u5173\u6d41\u7a0b\u3002<\/p>\n<h4><span class=\"ez-toc-section\" id=\"323_%E5%8D%A1%E9%A1%BF\"><\/span>3.2.3 \u5361\u987f<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u5361\u987f\u64cd\u4f5c\u7684\u7279\u70b9\u5728\u4e8e\u4e3b\u7ebf\u7a0b\u7684\u963b\u585e\u662f\u6682\u65f6\u6027\u548c\u53ef\u6062\u590d\u6027\u3002\u56e0\u6b64\u6211\u4eec\u8981\u83b7\u53d6\u5361\u987f\u6301\u7eed\u7684\u65f6\u95f4\uff0c\u7528\u6765\u8bc4\u4f30\u5361\u987f\u95ee\u9898\u7684\u4e25\u91cd\u6027\u3002\u6211\u4eec\u9884\u5148\u8bbe\u5b9a\u4e00\u4e2a\u5361\u987f\u65f6\u95f4\u7684\u9608\u503c T\uff0c\u5f53\u4e3b\u7ebf\u7a0b\u963b\u585e\u7684\u65f6\u95f4\u8d85\u8fc7\u8be5\u9608\u503c\uff0c\u5219\u4f1a\u89e6\u53d1\u4e3b\u7ebf\u7a0b\u7684\u5806\u6808\u6349\u53d6\uff0c\u76d1\u542c\u7ebf\u7a0b\u7ee7\u7eed\u7b49\u5f85\u4e3b\u7ebf\u7a0b\u76f4\u81f3\u6062\u590d\uff0c\u5e76\u8ba1\u7b97\u5361\u987f\u7684\u603b\u65f6\u95f4\uff0c\u6700\u540e\u628a\u5361\u987f\u603b\u65f6\u95f4\u548c\u5361\u987f\u5806\u6808\u4e0a\u62a5\u540e\u53f0\u3002\u5982\u679c\u4e3b\u7ebf\u7a0b\u8d85\u8fc7\u4e00\u5b9a\u7684\u65f6\u95f4\uff08\u6bd4\u5982 5 \u79d2\uff09\u4e00\u76f4\u65e0\u6cd5\u6062\u590d\uff0c\u5219\u4f1a\u89e6\u53d1\u5361\u6b7b\u68c0\u6d4b\u903b\u8f91\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u5361\u987f\u68c0\u6d4b\u6d41\u7a0b\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_21.png\" \/><\/p>\n<h4><span class=\"ez-toc-section\" id=\"324_%E5%8D%A1%E6%AD%BB\"><\/span>3.2.4 \u5361\u6b7b<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>iOS \u4f1a\u5bf9 APP \u7684\u4e3b\u7ebf\u7a0b\u8fdb\u884c\u76d1\u63a7\uff0c\u4e00\u65e6\u4e3b\u7ebf\u7a0b\u963b\u585e\u65f6\u95f4\u8d85\u8fc7\u4e00\u5b9a\u7684\u9600\u503c\uff08\u5361\u987f\u591a\u4e45\u4f1a\u88ab\u7cfb\u7edf\u5f3a\u6740\uff09\uff0ciOS \u5c31\u4f1a\u5f3a\u5236\u6740\u6b7b\u5f53\u524d\u8fdb\u7a0b\uff0c\u5e76\u4e14 app \u4e0d\u4f1a\u5f97\u5230\u4efb\u4f55\u901a\u77e5\u3002\u56e0\u6b64 app \u9700\u8981\u5728\u7cfb\u7edf\u5f3a\u6740\u4e4b\u524d\uff0c\u63d0\u524d\u68c0\u6d4b\u5230\u81ea\u8eab\u7684\u5361\u6b7b\u7684\u72b6\u6001\uff0c\u5e76\u91c7\u6837\u5361\u6b7b\u5806\u6808\u3002<\/p>\n<p>\u5361\u6b7b\u573a\u666f\u5e76\u4e0d\u4e00\u5b9a\u662f\u6b7b\u9501\u6216\u8005\u6b7b\u5faa\u73af\u5bfc\u81f4\u7684\uff0c\u4e5f\u6709\u53ef\u80fd\u662f\u6267\u884c\u4e86\u67d0\u4e9b\u7279\u522b\u7684\u8017\u65f6\u64cd\u4f5c\u3002\u7531\u4e8e\u53ef\u80fd\u5b58\u5728\u6b7b\u9501\u7684\u573a\u666f\uff0c\u53ea\u91c7\u96c6\u4e3b\u7ebf\u7a0b\u7684\u5806\u6808\u6709\u65f6\u662f\u4e0d\u8db3\u4e8e\u5b9a\u4f4d\u95ee\u9898\u7684\uff0c\u6240\u4ee5\u5361\u6b7b\u573a\u666f\u9700\u8981\u91c7\u96c6\u6240\u6709\u7ebf\u7a0b\u7684\u5806\u6808\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u5361\u6b7b\u68c0\u6d4b\u6d41\u7a0b\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_22.png\" \/><\/p>\n<h4><span class=\"ez-toc-section\" id=\"325_%E5%8D%A1%E9%A1%BF%E5%A0%86%E6%A0%88%E9%87%87%E9%9B%86%E4%BC%98%E5%8C%96\"><\/span>3.2.5 \u5361\u987f\u5806\u6808\u91c7\u96c6\u4f18\u5316<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u7531\u4e8e\u5361\u987f\u95ee\u9898\u5177\u6709\u6682\u65f6\u6027\u548c\u53ef\u6062\u590d\u6027\uff0c\u5f53\u68c0\u6d4b\u5230\u5361\u987f\u65f6\u95f4\u8d85\u8fc7\u4e00\u5b9a\u7684\u9600\u503c\u4e4b\u540e\uff0c\u8fdb\u884c\u5806\u6808\u91c7\u96c6\uff0c\u53ef\u80fd\u4f1a\u5b58\u5728\u8bef\u62a5\u7684\u573a\u666f\uff0c\u6bd4\u5982\u4e0b\u9762\u4f8b\u5b50\uff1a<\/p>\n<p><img decoding=\"async\" alt=\"\u5361\u987f\u5806\u6808\u91c7\u96c6\u95ee\u9898\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_23.png\" \/><\/p>\n<p>\u4e3b\u7ebf\u7a0b\u5361\u987f\u64cd\u4f5c\u662f 4\uff0c\u4f46\u7531\u4e8e\u5f00\u59cb\u91c7\u96c6\u5806\u6808\u7684\u65f6\u95f4\u70b9\u4efb\u52a1 4 \u5df2\u7ecf\u6267\u884c\u5b8c\u6210\uff0c\u8fd9\u65f6\u5019\u91c7\u96c6\u5230\u7684\u662f\u4efb\u52a1 5 \u7684\u5806\u6808\uff0c\u4e0a\u62a5\u7684\u4efb\u52a1 5 \u5806\u6808\u5e76\u4e0d\u662f\u771f\u6b63\u7684\u5361\u987f\u5806\u6808\u3002<\/p>\n<p>\u9488\u5bf9\u8fd9\u79cd\u573a\u666f\uff0c\u53ef\u4ee5\u901a\u8fc7\u91c7\u6837\u7b56\u7565\u63d0\u9ad8\u5806\u6808\u91c7\u96c6\u7684\u51c6\u786e\u6027\uff0c\u57fa\u672c\u601d\u8def\u5c31\u662f\u5728\u5e38\u89c4\u91c7\u96c6\u7684\u57fa\u7840\u4e0a\uff0c\u5728\u521a\u53d1\u751f\u5361\u987f\u7684\u65f6\u5019\uff0c\u5c31\u5f00\u59cb\u8fdb\u884c\u5806\u6808\u62bd\u6837\u91c7\u96c6\uff0c\u6574\u4f53\u5b9e\u73b0\u601d\u8def\u5982\u4e0b\uff1a<\/p>\n<p><img decoding=\"async\" alt=\"\u5806\u6808\u91c7\u6837\u7b56\u7565\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_24.png\" \/><\/p>\n<h4><span class=\"ez-toc-section\" id=\"326_%E5%90%8E%E5%8F%B0%E5%8D%A1%E6%AD%BB%E8%AF%AF%E6%8A%A5\"><\/span>3.2.6 \u540e\u53f0\u5361\u6b7b\u8bef\u62a5<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u540e\u53f0\u72b6\u6001\u4e0d\u8fdb\u884c\u5361\u987f\u68c0\u67e5\u4f46\u8981\u8fdb\u884c\u5361\u6b7b\u68c0\u6d4b\u3002<\/p>\n<p>\u53c2\u8003\uff1a<a href=\"https:\/\/blog.51cto.com\/u_15204236\/4960735\">\u540e\u53f0\u5361\u6b7b\u8bef\u62a5\u5904\u7406<\/a><\/p>\n<h4><span class=\"ez-toc-section\" id=\"327_%E7%9B%B8%E5%90%8C%E5%8D%A1%E9%A1%BF%E4%BC%98%E5%8C%96_%E2%80%93_%E9%80%80%E7%81%AB%E7%AE%97%E6%B3%95\"><\/span>3.2.7 \u76f8\u540c\u5361\u987f\u4f18\u5316 &#8211; \u9000\u706b\u7b97\u6cd5<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u4e3a\u4e86\u907f\u514d\u540c\u4e00\u5361\u987f\u95ee\u9898\u9891\u7e41\u7684\u68c0\u6d4b\u3001\u5806\u6808\u91c7\u96c6\u548c\u4e0a\u62a5\u3002\u5f53\u68c0\u6d4b\u5230\u540c\u4e00\u5361\u987f\u95ee\u9898\u7684\u65f6\u5019\uff0c\u4f7f\u7528\u9000\u706b\u7b97\u6cd5\u6765\u964d\u4f4e\u5361\u987f\u68c0\u6d4b\u5e26\u6765\u7684\u6027\u80fd\u635f\u8017\uff0c\u6309\u7167\u6590\u6ce2\u90a3\u5951\u6570\u5217\u5c06\u68c0\u67e5\u65f6\u95f4\u9012\u589e\u76f4\u5230\u6ca1\u6709\u9047\u5230\u5361\u987f\u6216\u8005\u4e3b\u7ebf\u7a0b\u5361\u987f\u5806\u6808\u4e0d\u4e00\u6837\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"33_%E4%B8%BB%E7%BA%BF%E7%A8%8B%E6%B6%88%E6%81%AF%E6%8E%A2%E6%B5%8B\"><\/span>3.3 \u4e3b\u7ebf\u7a0b\u6d88\u606f\u63a2\u6d4b<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p>\u4e3b\u7ebf\u7a0b\u6d88\u606f\u63a2\u6d4b\u539f\u7406\u662f\u5411\u4e3b\u7ebf\u7a0b\u53d1\u9001\u4e00\u4e2a\u4fe1\u53f7\uff0c\u4e00\u5b9a\u65f6\u95f4\u5185\u6536\u5230\u4e86\u4e3b\u7ebf\u7a0b\u7684\u56de\u590d\uff0c\u5373\u8868\u793a\u5f53\u524d\u4e3b\u7ebf\u7a0b\u6d41\u7545\u8fd0\u884c\u3002\u5982\u679c\u6ca1\u6709\u6536\u5230\u4e3b\u7ebf\u7a0b\u7684\u56de\u590d\uff0c\u5373\u8868\u793a\u5f53\u524d\u4e3b\u7ebf\u7a0b\u5728\u505a\u8017\u65f6\u8fd0\u7b97\uff0c\u53d1\u751f\u4e86\u5361\u987f\u3002<\/p>\n<p><strong>\u4e3b\u7ebf\u7a0b\u6d88\u606f\u63a2\u6d4b\u7684\u7f3a\u70b9<\/strong>\uff1a\u6bd4\u8f83\u8017\u7535\uff0c\u56e0\u4e3a\u5047\u5982 APP \u662f\u5904\u4e8e\u4f11\u7720\u72b6\u6001\uff0c\u4e0d\u95f4\u65ad\u7684\u6d88\u606f\u63a2\u6d4b\uff0c\u4f1a\u4e0d\u505c\u7684\u5524\u9192\u7cfb\u7edf\u548c APP\uff0c\u5e26\u6765\u989d\u5916\u7684\u7535\u6c60\u6d88\u8017\u3002<\/p>\n<h2><span class=\"ez-toc-section\" id=\"%E5%9B%9B%E3%80%81%E4%BC%98%E5%8C%96%E5%BB%BA%E8%AE%AE\"><\/span>\u56db\u3001\u4f18\u5316\u5efa\u8bae<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"41_CPU_%E4%BC%98%E5%8C%96\"><\/span>4.1 CPU \u4f18\u5316<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<h4><span class=\"ez-toc-section\" id=\"%E5%AF%B9%E8%B1%A1%E5%88%9B%E5%BB%BA\"><\/span>\u5bf9\u8c61\u521b\u5efa<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>\u8f7b\u91cf\u5bf9\u8c61\u4ee3\u66ff\u91cd\u91cf\u5bf9\u8c61\uff0c\u4e0d\u9700\u8981\u54cd\u5e94\u4e8b\u4ef6\u7684\uff0c\u7528 CALayer \u4ee3\u66ff UIView<\/li>\n<li>\u4ee3\u7801\u521b\u5efa\u4ee3\u66ff StoryBoard<\/li>\n<li>\u975e UI \u5bf9\u8c61\u653e\u5230\u540e\u53f0\u7ebf\u7a0b\u521b\u5efa<\/li>\n<li>\u5ef6\u8fdf\u5bf9\u8c61\u7684\u521b\u5efa<\/li>\n<li>\u590d\u7528\u5bf9\u8c61<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"%E5%AF%B9%E8%B1%A1%E8%B0%83%E6%95%B4\"><\/span>\u5bf9\u8c61\u8c03\u6574<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>CALayer \u548c UIView \u5c5e\u6027\u8c03\u6574\u6d88\u8017\u8d44\u6e90\u8981\u5927\u4e8e\u4e00\u822c\u7684\u5c5e\u6027<\/li>\n<li>\u907f\u514d\u8c03\u6574\u89c6\u56fe\u5c42\u7ea7\uff0c\u6dfb\u52a0\u6216\u8005\u5220\u9664\u89c6\u56fe\uff0c\u5c3d\u53ef\u80fd\u7684\u4f7f\u7528 <code>hidden<\/code> \u5c5e\u6027<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"%E5%AF%B9%E8%B1%A1%E9%94%80%E6%AF%81\"><\/span>\u5bf9\u8c61\u9500\u6bc1<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>\u975e UI \u5bf9\u8c61\u653e\u5230\u540e\u53f0\u7ebf\u7a0b\u53bb\u9500\u6bc1<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"%E5%B8%83%E5%B1%80%E8%AE%A1%E7%AE%97%E5%92%8C_AutoLayout\"><\/span>\u5e03\u5c40\u8ba1\u7b97\u548c AutoLayout<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>AutoLayout \u5bf9\u4e8e\u590d\u6742\u5e03\u5c40\u5b58\u5728\u4e25\u91cd\u6027\u80fd\u95ee\u9898<\/li>\n<li>\u540e\u53f0\u5e03\u5c40\u8ba1\u7b97\u548c\u5e03\u5c40\u7f13\u5b58<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"%E6%96%87%E6%9C%AC%E8%AE%A1%E7%AE%97\"><\/span>\u6587\u672c\u8ba1\u7b97<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u6587\u672c\u8ba1\u7b97\uff0c\u653e\u5230\u540e\u53f0\u7ebf\u7a0b\u6267\u884c\uff1a<\/p>\n<ul>\n<li><code>[NSAttributedString boundingRectWithSize:options:context:]<\/code> \u6765\u8ba1\u7b97\u6587\u672c\u5bbd\u9ad8<\/li>\n<li><code>[NSAttributedString drawWithRect:options:context:]<\/code> \u6765\u7ed8\u5236\u6587\u672c<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"%E6%96%87%E6%9C%AC%E7%BB%98%E5%88%B6\"><\/span>\u6587\u672c\u7ed8\u5236<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<ul>\n<li>\u7528 TextKit \u6216\u6700\u5e95\u5c42\u7684 CoreText \u5bf9\u6587\u672c\u5f02\u6b65\u7ed8\u5236<\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"%E5%9B%BE%E7%89%87%E8%A7%A3%E7%A0%81\"><\/span>\u56fe\u7247\u89e3\u7801<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u5f53\u4f60\u7528 <code>UIImage<\/code> \u6216 <code>CGImageSource<\/code> \u7684\u90a3\u51e0\u4e2a\u65b9\u6cd5\u521b\u5efa\u56fe\u7247\u65f6\uff0c\u56fe\u7247\u6570\u636e\u5e76\u4e0d\u4f1a\u7acb\u523b\u89e3\u7801\u3002\u56fe\u7247\u8bbe\u7f6e\u5230 <code>UIImageView<\/code> \u6216\u8005 <code>CALayer.contents<\/code> \u4e2d\u53bb\uff0c\u5e76\u4e14 CALayer \u88ab\u63d0\u4ea4\u5230 GPU \u524d\uff0cCGImage \u4e2d\u7684\u6570\u636e\u624d\u4f1a\u5f97\u5230\u89e3\u7801\u3002\u8fd9\u4e00\u6b65\u662f\u53d1\u751f\u5728\u4e3b\u7ebf\u7a0b\u7684\uff0c\u5e76\u4e14\u4e0d\u53ef\u907f\u514d\u3002<\/p>\n<p>\u5982\u679c\u60f3\u8981\u7ed5\u5f00\u8fd9\u4e2a\u673a\u5236\uff0c\u5e38\u89c1\u7684\u505a\u6cd5\u662f\u5728\u540e\u53f0\u7ebf\u7a0b\u5148\u628a\u56fe\u7247\u7ed8\u5236\u5230 <code>CGBitmapContext<\/code> \u4e2d\uff0c\u7136\u540e\u4ece Bitmap \u76f4\u63a5\u521b\u5efa\u56fe\u7247\u3002\u76ee\u524d\u5e38\u89c1\u7684\u7f51\u7edc\u56fe\u7247\u5e93\u90fd\u81ea\u5e26\u8fd9\u4e2a\u529f\u80fd\u3002<\/p>\n<h4><span class=\"ez-toc-section\" id=\"%E5%9B%BE%E5%83%8F%E7%BB%98%E5%88%B6\"><\/span>\u56fe\u50cf\u7ed8\u5236<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>\u56fe\u50cf\u7684\u7ed8\u5236\u901a\u5e38\u662f\u6307\u7528\u90a3\u4e9b\u4ee5 CG \u5f00\u5934\u7684\u65b9\u6cd5\u628a\u56fe\u50cf\u7ed8\u5236\u5230\u753b\u5e03\u4e2d\uff0c\u7136\u540e\u4ece\u753b\u5e03\u521b\u5efa\u56fe\u7247\u5e76\u663e\u793a\u8fd9\u6837\u4e00\u4e2a\u8fc7\u7a0b\u3002\u8fd9\u4e2a\u6700\u5e38\u89c1\u7684\u5730\u65b9\u5c31\u662f <code>[UIView drawRect:]<\/code> \u91cc\u9762\u4e86\u3002<\/p>\n<p>\u7531\u4e8e CoreGraphic \u65b9\u6cd5\u901a\u5e38\u90fd\u662f\u7ebf\u7a0b\u5b89\u5168\u7684\uff0c\u6240\u4ee5\u56fe\u50cf\u7684\u7ed8\u5236\u53ef\u4ee5\u5f88\u5bb9\u6613\u7684\u653e\u5230\u540e\u53f0\u7ebf\u7a0b\u8fdb\u884c\u3002\u4e00\u4e2a\u7b80\u5355\u5f02\u6b65\u7ed8\u5236\u7684\u8fc7\u7a0b\u5927\u81f4\u5982\u4e0b\uff08\u5b9e\u9645\u60c5\u51b5\u4f1a\u6bd4\u8fd9\u4e2a\u590d\u6742\u5f97\u591a\uff0c\u4f46\u539f\u7406\u57fa\u672c\u4e00\u81f4\uff09\uff1a<\/p>\n<pre><code class=\"language-objective-c\">- (void)display {\n    dispatch_async(backgroundQueue, ^{\n        CGContextRef ctx = CGBitmapContextCreate(...);\n        \/\/ draw in context...\n        CGImageRef img = CGBitmapContextCreateImage(ctx);\n        CFRelease(ctx);\n        dispatch_async(mainQueue, ^{\n            layer.contents = img;\n        });\n    });\n}\n<\/code><\/pre>\n<h4><span class=\"ez-toc-section\" id=\"411_%E5%9B%BE%E5%83%8F%E5%8A%A0%E8%BD%BD\"><\/span>4.1.1 \u56fe\u50cf\u52a0\u8f7d<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p><strong>\u56fe\u7247\u683c\u5f0f\u5bf9\u6bd4<\/strong>\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>\u683c\u5f0f<\/th>\n<th>\u4f18\u70b9<\/th>\n<th>\u7f3a\u70b9<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>PNG<\/td>\n<td>\u89e3\u538b\u5feb<\/td>\n<td>\u52a0\u8f7d\u6162<\/td>\n<\/tr>\n<tr>\n<td>JPEG<\/td>\n<td>\u89e3\u538b\u6162<\/td>\n<td>\u52a0\u8f7d\u5feb<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u56fe\u7247\u52a0\u8f7d\u65b9\u6cd5\u5bf9\u6bd4<\/strong>\uff1a<\/p>\n<table>\n<thead>\n<tr>\n<th>\u65b9\u6cd5<\/th>\n<th>\u4f18\u70b9<\/th>\n<th>\u7f3a\u70b9<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td><code>+imageNamed:<\/code><\/td>\n<td>\u7acb\u5373\u89e3\u538b\u56fe\u50cf\uff0c\u81ea\u5e26\u7f13\u5b58<\/td>\n<td>\u53ea\u80fd\u52a0\u8f7d\u8d44\u6e90\u675f\u7684\u56fe\u50cf<\/td>\n<\/tr>\n<tr>\n<td><code>+imageWithContentsOfFile:<\/code><\/td>\n<td>\u5ef6\u8fdf\u89e3\u538b\u56fe\u50cf<\/td>\n<td>&#8211;<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>\u5f3a\u5236\u89e3\u538b\u56fe\u50cf<\/strong>\uff1a<\/p>\n<ol>\n<li>\n<p>\u5c06\u56fe\u7247\u7684\u4e00\u4e2a\u50cf\u7d20\u7ed8\u5236\u6210\u4e00\u4e2a\u50cf\u7d20\u5927\u5c0f\u7684 CGContext\u3002\u8fd9\u6837\u4ecd\u7136\u4f1a\u89e3\u538b\u6574\u5f20\u56fe\u7247\uff0c\u4f46\u662f\u7ed8\u5236\u672c\u8eab\u5e76\u6ca1\u6709\u6d88\u8017\u4efb\u4f55\u65f6\u95f4\u3002\u8fd9\u6837\u7684\u597d\u5904\u5728\u4e8e\u52a0\u8f7d\u7684\u56fe\u7247\u5e76\u4e0d\u4f1a\u5728\u7279\u5b9a\u7684\u8bbe\u5907\u4e0a\u4e3a\u7ed8\u5236\u505a\u4f18\u5316\uff0c\u6240\u4ee5\u53ef\u4ee5\u5728\u4efb\u4f55\u65f6\u95f4\u70b9\u7ed8\u5236\u51fa\u6765\u3002\u540c\u6837 iOS \u4e5f\u5c31\u53ef\u4ee5\u4e22\u5f03\u89e3\u538b\u540e\u7684\u56fe\u7247\u6765\u8282\u7701\u5185\u5b58\u4e86\u3002<\/p>\n<\/li>\n<li>\n<p>\u5c06\u6574\u5f20\u56fe\u7247\u7ed8\u5236\u5230 CGContext \u4e2d\uff0c\u4e22\u5f03\u539f\u59cb\u7684\u56fe\u7247\uff0c\u5e76\u4e14\u7528\u4e00\u4e2a\u4ece\u4e0a\u4e0b\u6587\u5185\u5bb9\u4e2d\u65b0\u7684\u56fe\u7247\u6765\u4ee3\u66ff\u3002\u8fd9\u6837\u6bd4\u7ed8\u5236\u5355\u4e00\u50cf\u7d20\u90a3\u6837\u9700\u8981\u66f4\u52a0\u590d\u6742\u7684\u8ba1\u7b97\uff0c\u4f46\u662f\u56e0\u6b64\u4ea7\u751f\u7684\u56fe\u7247\u5c06\u4f1a\u4e3a\u7ed8\u5236\u505a\u4f18\u5316\uff0c\u800c\u4e14\u7531\u4e8e\u539f\u59cb\u538b\u7f29\u56fe\u7247\u88ab\u629b\u5f03\u4e86\uff0ciOS \u5c31\u4e0d\u80fd\u591f\u968f\u65f6\u4e22\u5f03\u4efb\u4f55\u89e3\u538b\u540e\u7684\u56fe\u7247\u6765\u8282\u7701\u5185\u5b58\u4e86\u3002<\/p>\n<\/li>\n<\/ol>\n<h3><span class=\"ez-toc-section\" id=\"42_GPU_%E4%BC%98%E5%8C%96\"><\/span>4.2 GPU \u4f18\u5316<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>\u5c3d\u91cf\u51cf\u5c11\u5728\u77ed\u65f6\u95f4\u5185\u5927\u91cf\u56fe\u7247\u7684\u663e\u793a\uff0c\u5c3d\u53ef\u80fd\u5c06\u591a\u5f20\u56fe\u7247\u5408\u6210\u4e3a\u4e00\u5f20\u8fdb\u884c\u663e\u793a<\/li>\n<li><strong>GPU \u80fd\u5904\u7406\u7684\u6700\u5927\u7eb9\u7406\u5c3a\u5bf8\u662f 4096 * 4096\uff0c\u8d85\u8fc7\u8fd9\u4e2a\u5c3a\u5bf8\u5c31\u4f1a\u5360\u7528 CPU \u8d44\u6e90\uff0c\u6240\u4ee5\u7eb9\u7406\u4e0d\u80fd\u8d85\u8fc7\u8fd9\u4e2a\u5c3a\u5bf8<\/strong><\/li>\n<li><strong>\u5c3d\u91cf\u51cf\u5c11\u89c6\u56fe\u7684\u6570\u91cf\u548c\u5c42\u6b21<\/strong><\/li>\n<li><strong>\u51cf\u5c11\u900f\u660e\u7684\u89c6\u56fe\uff08alpha &lt; 1\uff09\uff0c\u4e0d\u900f\u660e\u7684\u5c31\u8bbe\u7f6e <code>opaque<\/code> \u4e3a YES\uff0c\u900f\u660e\u5ea6\u6d89\u53ca\u5230\u6df7\u5408\u989c\u8272\u7684\u8ba1\u7b97<\/strong><\/li>\n<li><strong>\u5c3d\u91cf\u907f\u514d\u51fa\u73b0\u79bb\u5c4f\u6e32\u67d3<\/strong><\/li>\n<\/ul>\n<h4><span class=\"ez-toc-section\" id=\"421_%E7%A6%BB%E5%B1%8F%E6%B8%B2%E6%9F%93\"><\/span>4.2.1 \u79bb\u5c4f\u6e32\u67d3<span class=\"ez-toc-section-end\"><\/span><\/h4>\n<p>CALayer \u7684\u8fb9\u6846\u3001\u5706\u89d2\u3001\u9634\u5f71\u3001\u906e\u7f69\uff08mask\uff09\uff0cCASharpLayer \u7684\u77e2\u91cf\u56fe\u5f62\u663e\u793a\uff0c\u901a\u5e38\u4f1a\u89e6\u53d1\u79bb\u5c4f\u6e32\u67d3\uff08offscreen rendering\uff09\u3002<\/p>\n<h5><span class=\"ez-toc-section\" id=\"4211_%E7%A6%BB%E5%B1%8F%E6%B8%B2%E6%9F%93%E5%8E%9F%E7%90%86\"><\/span>4.2.1.1 \u79bb\u5c4f\u6e32\u67d3\u539f\u7406<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<p>\u56fe\u5c42\u7684\u53e0\u52a0\u7ed8\u5236\u5927\u6982\u9075\u5faa&#8221;\u753b\u5bb6\u7b97\u6cd5&#8221;\u3002<\/p>\n<p><strong>\u6cb9\u753b\u7b97\u6cd5<\/strong>\uff1a\u5148\u7ed8\u5236\u573a\u666f\u4e2d\u7684\u79bb\u89c2\u5bdf\u8005\u8f83\u8fdc\u7684\u7269\u4f53\uff0c\u518d\u7ed8\u5236\u8f83\u8fd1\u7684\u7269\u4f53\u3002\u5148\u7ed8\u5236\u7ea2\u8272\u90e8\u5206\uff0c\u518d\u7ed8\u5236\u9ec4\u8272\u90e8\u5206\uff0c\u6700\u540e\u518d\u7ed8\u5236\u7070\u8272\u90e8\u5206\uff0c\u5373\u53ef\u89e3\u51b3\u9690\u85cf\u9762\u6d88\u9664\u7684\u95ee\u9898\u3002\u5373\u5c06\u573a\u666f\u6309\u7167\u7269\u7406\u8ddd\u79bb\u548c\u89c2\u5bdf\u8005\u7684\u8ddd\u79bb\u8fdc\u8fd1\u6392\u5e8f\uff0c\u7531\u8fdc\u53ca\u8fd1\u7684\u7ed8\u5236\u5373\u53ef\u3002<\/p>\n<p><img decoding=\"async\" alt=\"\u79bb\u5c4f\u6e32\u67d3\u539f\u7406\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_25.png\" \/><\/p>\n<p>\u5f53\u6211\u4eec\u8bbe\u7f6e\u4e86 <code>cornerRadius<\/code> \u4ee5\u53ca <code>masksToBounds<\/code> \u8fdb\u884c\u5706\u89d2+\u88c1\u526a\u65f6\uff0c<code>masksToBounds<\/code> \u88c1\u526a\u5c5e\u6027\u4f1a\u5e94\u7528\u5230\u6240\u6709\u7684\u56fe\u5c42\u4e0a\u3002<\/p>\n<p>\u672c\u6765\u6211\u4eec\u4ece\u540e\u5f80\u524d\u7ed8\u5236\uff0c\u7ed8\u5236\u5b8c\u4e00\u4e2a\u56fe\u5c42\u5c31\u53ef\u4ee5\u4e22\u5f03\u4e86\u3002\u4f46\u73b0\u5728\u9700\u8981\u4f9d\u6b21\u5728 Offscreen Buffer \u4e2d\u4fdd\u5b58\uff0c\u7b49\u5f85\u5706\u89d2+\u88c1\u526a\u5904\u7406\uff0c\u5373\u5f15\u53d1\u4e86<strong>\u79bb\u5c4f\u6e32\u67d3<\/strong>\u3002<\/p>\n<ul>\n<li>\u80cc\u666f\u8272\u3001\u8fb9\u6846\u3001\u80cc\u666f\u8272+\u8fb9\u6846\uff0c\u518d\u52a0\u4e0a\u5706\u89d2+\u88c1\u526a\uff0c\u6839\u636e\u6587\u6863\u8bf4\u660e\uff0c\u56e0\u4e3a <code>contents = nil<\/code> \u6ca1\u6709\u9700\u8981\u88c1\u526a\u5904\u7406\u7684\u5185\u5bb9\uff0c\u6240\u4ee5 <code>masksToBounds<\/code> \u8bbe\u7f6e\u4e3a YES \u6216\u8005 NO \u90fd\u6ca1\u6709\u5f71\u54cd\u3002<\/li>\n<li>\u4e00\u65e6\u6211\u4eec\u4e3a <code>contents<\/code> \u8bbe\u7f6e\u4e86\u5185\u5bb9\uff0c\u65e0\u8bba\u662f\u56fe\u7247\u3001\u7ed8\u5236\u5185\u5bb9\u3001\u6709\u56fe\u50cf\u4fe1\u606f\u7684\u5b50\u89c6\u56fe\u7b49\uff0c\u518d\u52a0\u4e0a\u5706\u89d2+\u88c1\u526a\uff0c\u5c31\u4f1a\u89e6\u53d1\u79bb\u5c4f\u6e32\u67d3\u3002<\/li>\n<\/ul>\n<h5><span class=\"ez-toc-section\" id=\"4212_%E5%9C%86%E8%A7%92%E7%A6%BB%E5%B1%8F%E6%B8%B2%E6%9F%93\"><\/span>4.2.1.2 \u5706\u89d2\u79bb\u5c4f\u6e32\u67d3<span class=\"ez-toc-section-end\"><\/span><\/h5>\n<p><code>cornerRadius + masksToBounds<\/code> \u4e0d\u4e00\u5b9a\u4f1a\u89e6\u53d1\u79bb\u5c4f\u6e32\u67d3\uff0c\u6dfb\u52a0 <code>contents<\/code> \u4f1a\u89e6\u53d1\u79bb\u5c4f\u6e32\u67d3\uff0c\u6216\u8005\u4e3a\u89c6\u56fe\u6dfb\u52a0\u4e00\u4e2a\u6709\u989c\u8272\u3001\u5185\u5bb9\u6216\u8fb9\u6846\u7b49\u6709\u56fe\u50cf\u4fe1\u606f\u7684\u5b50\u89c6\u56fe\u4e5f\u4f1a\u89e6\u53d1\u79bb\u5c4f\u6e32\u67d3\u3002<\/p>\n<p>\u5173\u4e8e\u5706\u89d2\uff0ciOS 9 \u53ca\u4e4b\u540e\u7684\u7cfb\u7edf\u7248\u672c\uff0c\u82f9\u679c\u8fdb\u884c\u4e86\u4e00\u4e9b\u4f18\u5316\u3002\u6211\u4eec\u53ea\u8bbe\u7f6e <code>contents<\/code> \u6216\u8005 <code>UIImageView<\/code> \u7684 <code>image<\/code>\uff0c\u5e76\u52a0\u4e0a\u5706\u89d2+\u88c1\u526a\uff0c\u662f\u4e0d\u4f1a\u4ea7\u751f\u79bb\u5c4f\u6e32\u67d3\u7684\u3002\u4f46\u5982\u679c\u52a0\u4e0a\u4e86\u80cc\u666f\u8272\u3001\u8fb9\u6846\u6216\u5176\u4ed6\u6709\u56fe\u50cf\u5185\u5bb9\u7684\u56fe\u5c42\uff0c\u8fd8\u662f\u4f1a\u4ea7\u751f\u79bb\u5c4f\u6e32\u67d3\u3002<\/p>\n<h3><span class=\"ez-toc-section\" id=\"43_%E9%AB%98%E6%95%88%E7%BB%98%E5%9B%BE\"><\/span>4.3 \u9ad8\u6548\u7ed8\u56fe<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<ul>\n<li>\u907f\u514d\u8f6f\u4ef6\u7ed8\u56fe<\/li>\n<li>\u4f7f\u7528 CAShapeLayer \u8fdb\u884c\u77e2\u91cf\u56fe\u5f62\u7ed8\u5236<\/li>\n<li>\u53ea\u89e6\u53d1\u810f\u77e9\u5f62\u7ed8\u5236<\/li>\n<li>\u4f7f\u7528 CATiledLayer \u8fdb\u884c\u5f02\u6b65\u7ed8\u5236<\/li>\n<li><code>shouldRasterize<\/code> \u81ea\u5e26\u7f13\u5b58\u4f5c\u7528\uff0c\u8981\u907f\u514d\u4f5c\u7528\u5728\u5185\u5bb9\u4e0d\u65ad\u53d8\u52a8\u7684\u56fe\u5c42\u4e0a\uff0c\u5426\u5219\u5b83\u7f13\u5b58\u65b9\u9762\u7684\u597d\u5904\u5c31\u4f1a\u6d88\u5931\uff0c\u800c\u4e14\u4f1a\u8ba9\u6027\u80fd\u53d8\u7684\u66f4\u7cdf<\/li>\n<li>\u5982\u679c\u6ca1\u6709\u81ea\u5b9a\u4e49\u7ed8\u5236\u7684\u4efb\u52a1\u5c31\u4e0d\u8981\u5728\u5b50\u7c7b\u4e2d\u5199\u4e00\u4e2a\u7a7a\u7684 <code>-drawRect:<\/code> \u65b9\u6cd5\uff0c\u56e0\u4e3a\u7cfb\u7edf\u4f1a\u4e3a\u89c6\u56fe\u5206\u914d\u4e00\u4e2a\u5bc4\u5bbf\u56fe\uff0c\u8fd9\u4e2a\u5bc4\u5bbf\u56fe\u7684\u50cf\u7d20\u5c3a\u5bf8\u7b49\u4e8e\u89c6\u56fe\u5927\u5c0f\u4e58\u4ee5 <code>contentsScale<\/code> \u7684\u503c\uff0c\u9020\u6210 CPU \u6d6a\u8d39<\/li>\n<\/ul>\n<h2><span class=\"ez-toc-section\" id=\"%E4%BA%94%E3%80%81%E4%BC%98%E5%8C%96%E6%A1%88%E4%BE%8B\"><\/span>\u4e94\u3001\u4f18\u5316\u6848\u4f8b<span class=\"ez-toc-section-end\"><\/span><\/h2>\n<h3><span class=\"ez-toc-section\" id=\"51_%E7%BD%91%E7%BB%9C%E6%93%8D%E4%BD%9C%E6%94%BE%E5%88%B0%E9%9D%9E%E4%B8%BB%E7%BA%BF%E7%A8%8B\"><\/span>5.1 \u7f51\u7edc\u64cd\u4f5c\u653e\u5230\u975e\u4e3b\u7ebf\u7a0b<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><img decoding=\"async\" alt=\"\u7f51\u7edc\u64cd\u4f5c\u4f18\u5316\u6848\u4f8b\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_26.png\" \/><\/p>\n<h3><span class=\"ez-toc-section\" id=\"52_%E6%B8%B2%E6%9F%93%E5%8D%A1%E9%A1%BF\"><\/span>5.2 \u6e32\u67d3\u5361\u987f<span class=\"ez-toc-section-end\"><\/span><\/h3>\n<p><img decoding=\"async\" alt=\"\u6e32\u67d3\u5361\u987f\u6848\u4f8b 1\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_27.png\" \/><\/p>\n<p><img decoding=\"async\" alt=\"\u6e32\u67d3\u5361\u987f\u6848\u4f8b 2\" src=\"https:\/\/www.ixriver.com\/wp-content\/uploads\/2026\/02\/image_28.png\" \/><\/p>\n<p><strong>\u95ee\u9898\u8bf4\u660e<\/strong>\uff1a<code>nextDrawable<\/code> \u4ece\u5bf9\u8c61\u6c60\u83b7\u53d6 <code>CAMetalDrawable<\/code>\uff0c\u5f53\u76ee\u6807\u6ca1\u6709\u7a7a\u4f59\u7684 Drawable \u7684\u65f6\u5019\uff0c\u4e3b\u7ebf\u7a0b\u5c31\u4f1a\u88ab\u963b\u585e\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>iOS \u5361\u987f\u4f18\u5316 \u4e00\u3001\u539f\u7406 1.1 \u5c4f\u5e55\u663e\u793a\u56fe\u50cf\u539f\u7406 \u9996\u5148\u4ece\u8fc7\u53bb\u7684 CRT \u663e\u793a\u5668\u539f\u7406\u8bf4\u8d77\u3002CRT \u7684\u7535\u5b50\u67aa\u6309 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[36],"tags":[],"blocksy_meta":[],"featured_image_urls":{"full":"","thumbnail":"","medium":"","medium_large":"","large":"","1536x1536":"","2048x2048":""},"post_excerpt_stackable":"<p>\u76ee\u5f55 Toggle iOS \u5361\u987f\u4f18\u5316\u4e00\u3001\u539f\u74061.1 \u5c4f\u5e55\u663e\u793a\u56fe\u50cf\u539f\u74061.2 \u5361\u987f\u4ea7\u751f\u7684\u539f\u56e01.3 iOS \u6e32\u67d3\u5faa\u73af1.3.1 \u4e8b\u4ef6\u51c6\u59071.3.2 \u63d0\u4ea4\u9636\u6bb51.3.3 \u6e32\u67d3\u51c6\u59071.3.4 \u6e32\u67d3\u6267\u884c1.3&hellip;<\/p>\n","category_list":"<a href=\"https:\/\/ixriver.com\/?cat=36\" rel=\"category\">\u6027\u80fd\u4f18\u5316<\/a>","author_info":{"name":"admin","url":"https:\/\/ixriver.com\/?author=1"},"comments_num":"0 comments","_links":{"self":[{"href":"https:\/\/ixriver.com\/index.php?rest_route=\/wp\/v2\/posts\/898"}],"collection":[{"href":"https:\/\/ixriver.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ixriver.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ixriver.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ixriver.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=898"}],"version-history":[{"count":0,"href":"https:\/\/ixriver.com\/index.php?rest_route=\/wp\/v2\/posts\/898\/revisions"}],"wp:attachment":[{"href":"https:\/\/ixriver.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=898"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ixriver.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=898"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ixriver.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=898"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}