{"id":323583,"date":"2021-02-06T03:57:48","date_gmt":"2021-02-05T19:57:48","guid":{"rendered":"http:\/\/4563.org\/?p=323583"},"modified":"2021-02-06T03:57:48","modified_gmt":"2021-02-05T19:57:48","slug":"%e6%9c%80%e8%bf%91%e5%88%9a%e5%88%9a%e5%bc%80%e5%a7%8b-ios-%e5%bc%80%e5%8f%91%ef%bc%8c%e4%bd%bf%e7%94%a8%e7%9a%84%e6%98%af-swift-%ef%bc%88%e9%9d%9e-swiftui%ef%bc%89%e5%bc%80%e5%8f%91%ef%bc%8c%e5%8f%91","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=323583","title":{"rendered":"\u6700\u8fd1\u521a\u521a\u5f00\u59cb IOS \u5f00\u53d1\uff0c\u4f7f\u7528\u7684\u662f Swift \uff08\u975e swiftUI\uff09\u5f00\u53d1\uff0c\u53d1\u73b0\u4e86\u4e00\u4e2a\u95ee\u9898\uff0c\u56f0\u6270\u4e86\u6211\uff0c\u5e0c\u671b\u6709\u5927\u4f6c\u53ef\u4ee5\u89e3\u7b54"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u6700\u8fd1\u521a\u521a\u5f00\u59cb IOS \u5f00\u53d1\uff0c\u4f7f\u7528\u7684\u662f Swift \uff08\u975e swiftUI\uff09\u5f00\u53d1\uff0c\u53d1\u73b0\u4e86\u4e00\u4e2a\u95ee\u9898\uff0c\u56f0\u6270\u4e86\u6211\uff0c\u5e0c\u671b\u6709\u5927\u4f6c\u53ef\u4ee5\u89e3\u7b54               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Xcution <\/span>  <span><i><\/i> 10<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u6211\u53d1\u73b0\u5f88\u591a\u5730\u65b9\u90fd\u8981\u56fa\u5b9a\u5199\u6b7b\u63a7\u4ef6\u7684\u9ad8\u5ea6\uff0c\u5bbd\u5ea6\uff1f\u96be\u9053\u6ca1\u6709\u81ea\u9002\u5e94\u7684\u65b9\u5f0f\u561b\uff1f<\/p>\n<p>\u6211\u5728\u7f51\u4e0a\u641c\u4e86\u7528 SnapKit \u7684\u65b9\u5f0f\u53ef\u4ee5\u4e0d\u8bbe\u7f6e\u63a7\u4ef6\u7684\u9ad8\u5bbd\u6765\u4f7f\u7528\uff0c\u8fd9\u4e2a\u7b97\u662f\u4e00\u79cd\u65b9\u5f0f\uff0c\u4f46\u662f\u7528\u4e86\u8fd9\u4e2a\u65b9\u5f0f\u4e4b\u540e\uff0c\u83b7\u53d6\u63a7\u4ef6\u7684\u9ad8\u5bbd\u6709\u65f6\u5019\u4e3a 0\uff0c\u597d\u50cf\u662f\u56e0\u4e3a snapKit \u662f\u5f02\u6b65\u7684\u539f\u56e0\uff0c\u592a\u75db\u82e6\u4e86\uff0c\u6709\u65f6\u5019\u5c31\u662f\u9700\u8981\u9ad8\u5bbd\u4f46\u662f\u83b7\u53d6\u4e0d\u5230<\/p>\n<p>\u7136\u540e\u8fd8\u6709\u4e2a\u95ee\u9898\u5c31\u662f\u63a7\u4ef6\u7684\u9ad8\u5bbd\u6839\u636e\u5185\u5bb9\u81ea\u9002\u5e94\uff0c\u6211\u611f\u89c9\u8fd9\u4e2a\u662f\u6700\u5934\u75db\u7684\uff0c\u4e0a\u9762\u7684 snapkit \u662f\u548c\u7236\u5e03\u5c40\u7684\u9ad8\u5bbd\u62c9\u4f38\uff0c\u4f46\u662f\u6709\u65f6\u5019\u6211\u60f3\u6839\u636e\u5b50\u63a7\u4ef6\u5185\u5bb9\u81ea\u52a8\u9002\u5e94\u9ad8\u5bbd\u600e\u4e48\u5f04\u5440<\/p>\n<p>\u8fd9\u6bb5\u65f6\u95f4\u4e00\u76f4\u5728\u5f04\u63a7\u4ef6\u5bbd\u5ea6\u9ad8\u5ea6\u7684\u95ee\u9898\uff0c\u592a\u75db\u82e6\u4e86\uff0c\u56e0\u4e3a\u4ee5\u524d\u662f\u5b89\u5353\u5f00\u53d1\uff0c\u5b89\u5353\u786e\u5b9e\u6ca1\u8fd9\u4e48\u9ebb\u70e6\uff0c\u5982\u679c\u771f\u7684\u53ea\u80fd\u8fd9\u6837\u7684\u8bdd\u5b89\u5353\u5176\u4ed6\u4e0d\u8bf4\u81f3\u5c11\u5728\u8fd9\u65b9\u9762\u8fd8\u662f\u8981\u65b9\u4fbf\u70b9\u7684\uff0c\u6211\u60f3\u6211\u5e94\u8be5\u662f\u54ea\u91cc\u6ca1\u5f04\u5bf9\uff0c\u662f\u5426\u6709\u5927\u4f6c\u89e3\u7b54\u4e00\u4e0b\uff0c\u6216\u8005\u6709\u76f8\u5173\u7684\u8d44\u6599\u4e5f\u884c\uff0c\u6211\u611f\u89c9\u6211\u8fd9\u6837\u5f00\u53d1\u7684\uff0c\u95ee\u9898\u592a\u591a\u4e86      <\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>34<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"4980988\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : gdtdpt <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u662f\u4e13\u4e1a App \u5f00\u53d1\uff0c\u53ea\u662f\u641e\u8fc7\u4e00\u9635\u5b50\uff0c\u6211\u8bb0\u5f97 iOS \u7684\u9ed8\u8ba4\u5e03\u5c40\u65b9\u5f0f\u5c31\u662f\u5b89\u5353\u91cc\u7684\u7ea6\u675f\u5e03\u5c40\uff0c\u53ea\u8981\u8bbe\u7f6e\u5143\u7d20\u81ea\u8eab\u7684\u7ea6\u675f\u3001\u5143\u7d20\u4e0e\u5143\u7d20\u4e4b\u95f4\u7684\u7ea6\u675f\u3001\u5143\u7d20\u4e0e\u7236\u5143\u7d20\u7684\u7ea6\u675f\u5c31\u80fd\u81ea\u9002\u5e94\u4e86\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4980989\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : linKnowEasy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u641c\u4e00\u4e0b SnapKit \u81ea\u9002\u5e94 + \u4f60\u8981\u81ea\u9002\u5e94\u7684\u63a7\u4ef6.                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4980990\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : timelessg <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u672c\u8d28\u8fd8\u662f autolayout \u7684\u95ee\u9898\uff0c\u9996\u5148\u5b50 view \u9700\u8981\u6709 contentsize\uff0c\u4e5f\u5c31\u662f\u5b50 view \u8981\u5148\u628a\u81ea\u5df1\u6491\u8d77\u6765\uff0c\u5176\u6b21\u5404\u4e2a\u5b50 view \u4e4b\u95f4\u7684\u7ea6\u675f\u8981\u8bbe\u5bf9\uff0c\u8fd9\u6837\u624d\u4f1a\u6491\u8d77\u6765\u7236 view                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4980991\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Xcution <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @gdtdpt \u4f46\u662f\u6211\u7528\u7684\u4ee3\u7801\u8fdb\u884c\u5e03\u5c40\u7684\uff0c\u4e0d\u77e5\u9053\u600e\u4e48\u5f04\uff0c\u7f51\u4e0a\u641c\u4e86\u4e5f\u6ca1\u641c\u5230\u76f8\u5173\u7684\u8d44\u6599<br \/>@linKnowEasy \u6211\u53bb\u641c\u641c\u770b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4980992\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Xcution <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @timelessg \u6709\u76f8\u5173\u7684\u8d44\u6599\u53ef\u4ee5\u770b\u561b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4980993\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : finab <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5e03\u5c40\u5e94\u8be5\u4e0d\u9700\u8981\u786e\u5207\u7684 \u9ad8\u5ea6\uff0c\u53ef\u4ee5\u628a\u4f60\u8981\u7684\u5e03\u5c40\u8bf4\u4e00\u8bf4                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4980994\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : linKnowEasy <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u641c\u4e0b SnapKit \u6559\u7a0b https:\/\/www.jianshu.com\/p\/332b816cd3e4<\/p>\n<p>\u8fd9\u4e2a\u6982\u5ff5\u5176\u5b9e\u5c31\u662f View \u6ca1\u6709\u56fa\u5b9a\u5927\u5c0f. \u90fd\u662f\u76f8\u5bf9 superview \u6216\u8005\u540c\u7ea7\u7684 View                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4980995\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : cincout <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u7ed9\u4f60\u6253\u4e86\u4e00\u5806\u5b57\uff0c\u7136\u540e\u53d1\u73b0\u6211\u5e76\u4e0d\u64c5\u957f\u7ed9\u522b\u4eba\u8bb2\u89e3\u3002\u3002\u3002\u8fd8\u662f\u7ed9\u4f60\u4e2a\u601d\u8def\u5427\uff0c\u5176\u5b9e\u5f88\u7b80\u5355\uff0c\u60f3\u8981\u81ea\u9002\u5e94\u5185\u5bb9\u7684\u9ad8\u5ea6\uff0c\u4f60\u5f97\u8ba9\u5185\u5bb9\u7684\u4e0a\u4e0b\u7ea6\u675f\u90fd\u56fa\u5b9a\u5728 contentView \u4e0a\uff0c\u4e14\u4fdd\u8bc1\u5185\u5bb9\u81ea\u8eab\u6709\u9ad8\u5ea6\uff0c\u5982\u679c\u662f\u591a\u884c UIlabel\uff0c\u5f97\u4fdd\u8bc1 UIlabel \u6709\u56fa\u5b9a\u5bbd\u5ea6\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4980996\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : imkerberos <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             FlexBox\uff0c \u4f60\u503c\u5f97\u62e5\u6709\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4980997\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : everhere <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             snapkit \u53ef\u4ee5\u8bbe\u7f6e\u5bbd\u9ad8\uff0c\u6bd4\u5982<br \/>make.width.equalTo<br \/>make.height.equalTo                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4980998\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Building <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f60\u5c31\u6ca1\u6709\u60f3\u8fc7 Android \u867d\u7136\u4e0d\u7528\u5199\u9ad8\u5ea6\uff0c\u90a3\u9ad8\u5ea6\u600e\u4e48\u6765\u7684\uff1f\u80af\u5b9a\u8fd8\u662f\u8981\u7b97\u7684\u554a\uff0c\u5b50\u89c6\u56fe\u6ca1\u6709\u9ad8\u5ea6\uff0c\u90a3\u4e48\u80af\u5b9a\u6709\u4e00\u4e2a\u9ad8\u5ea6\u786e\u5b9a\u7684\u7236\u5bb9\u5668\uff0c\u7136\u540e\u901a\u8fc7\u7ea6\u675f\u8ba1\u7b97\u5f97\u51fa\u5b50\u89c6\u56fe\u7684\u9ad8\u5ea6\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4980999\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ooops <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u628a\u4e2a AutoLayout \u7684\u6559\u7a0b\u7cfb\u7edf\u7684\u770b\u4e00\u4e0b\u5427\uff0c\u73b0\u5728\u8fd9\u4e48\u95ee\u6ca1\u6cd5\u56de\u7b54\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981000\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : yikuo <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u8fd9\u5176\u5b9e\u8ddf snapkit \u6ca1\u5173\u7cfb\uff0ciOS \u7684 autolayout \u5e03\u5c40\u65b9\u5f0f\u5c31\u662f\u8fd9\u6837\u7684\u3002\u6709\u7684\u5730\u65b9\u53ef\u4ee5\u4f7f\u7528 UIStackView \u6765\u7b80\u5316\u7ea6\u675f\u3002\u81f3\u4e8e\u83b7\u53d6\u4e0d\u5230\u5bbd\u9ad8\uff0c\u662f\u56e0\u4e3a\u4f60\u83b7\u53d6\u7684\u65f6\u5019 UI \u8fd8\u6ca1\u8ba1\u7b97\u51fa\u771f\u6b63\u7684\u5927\u5c0f\uff0c\u8fd9\u91cc\u6709\u4e24\u4e2a\u9009\u62e9\uff1a\u53ea\u7528\u7ea6\u675f\u4e0d\u8981\u624b\u52a8\u8bbe\u7f6e\u5bbd\u9ad8\uff0c\u6216\u8005\u5728 layoutsubview \u4e4b\u540e\u518d\u83b7\u53d6\u5bbd\u9ad8\u3002\u6211\u4e2a\u4eba\u89c9\u5f97 Android \u7684\u5e03\u5c40\u6bd4 iOS \u7b80\u5355\u5f88\u591a\uff0cAndroid \u6709\u591a\u79cd\u5e03\u5c40\u65b9\u5f0f\u7ec4\u5408\u4f7f\u7528\uff0c\u53ef\u4ee5\u4e13\u5fc3\u5e03\u5c40\uff0c\u800c iOS \u5c31\u53ea\u6709 frame \u548c autolayout \u4ee5\u53ca UIStackView \u4e86\uff0c\u9700\u8981\u8017\u8d39\u5f88\u591a\u7cbe\u529b\u5728\u8c03\u6574\u4f4d\u7f6e\u548c\u5927\u5c0f\u4e0a\u9762\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981001\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : StyxS <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4f18\u5148\u7ea7\u548c\u6297\u4f38\u7f29\u6027                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981002\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : ydatong <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u53ef\u4ee5\u770b\u770b uistackview\uff0c\u4e00\u822c\u7684\u5e03\u5c40\u80fd\u7701\u4e0d\u5c11\u4e8b                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981003\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Baymaxbowen <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             equal to superview offset                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981004\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : coloz <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e3a\u4ec0\u4e48\u4e0d\u9009\u62e9\u8de8\u5e73\u53f0\u7684\u5f00\u53d1\u65b9\u5f0f\u5462\uff0c\u641e\u4e24\u5957 app \u592a\u7d2f\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981005\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : vincentxue <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0d\u662f\u4f60\u6ca1\u5f04\u5bf9\uff0c\u800c\u662f iOS \u7684\u5e03\u5c40\u7cfb\u7edf\u4ee5\u53ca\u5b83\u7684\u547d\u4ee4\u5f0f UI \u5f00\u53d1\u4f53\u9a8c\u8ddf Android \u6bd4\u7b80\u76f4\u5c31\u662f\u4e00\u5768\u5c4e\uff0c\u66f4\u522b\u63d0\u548c Web \u6bd4\u4e86\u3002<\/p>\n<p>iOS \u7684 Auto Layout \u57fa\u672c\u4e0a\u7b49\u540c\u4e8e Android \u4e2d\u7684 ConstraintLayout\uff0c\u90fd\u662f\u57fa\u4e8e\u7ea6\u675f\u7684\u5e03\u5c40\u7cfb\u7edf\u3002\u6700\u5927\u7684\u4e0d\u540c\u70b9\u5728\u4e8e iOS \u4e2d\u63a7\u4ef6\u7684\u5c3a\u5bf8\u57fa\u672c\u4e0a\u9664\u4e86 UILabel \/ UITextView \uff08\u76f8\u5f53\u4e8e Android \u4e2d\u7684 TextView \uff09\u3001UIButton \uff08\u76f8\u5f53\u4e8e Android \u4e2d\u7684 *Button \uff09\u3001UIImageView \uff08\u76f8\u5f53\u4e8e Android \u4e2d\u7684 ImageView \uff09\u4e4b\u7c7b\u6709\u5185\u5bb9\u7684\u63a7\u4ef6\u8fd8\u6709\u4e00\u4e9b\u7cfb\u7edf\u56fa\u5b9a\u5c3a\u5bf8\u7684\u63a7\u4ef6\uff08\u5982 UISegmentedControl \u3001UISearchBar \u7b49\uff09\u5916\uff0c\u90fd\u662f\u6ca1\u6709\u9ed8\u8ba4\u5c3a\u5bf8\u7684\u3002\u5b83\u4eec\u7684\u5c3a\u5bf8\u662f\u57fa\u4e8e\u7ea6\u675f\u8ba1\u7b97\u51fa\u6765\u7684\u3002<\/p>\n<p>\u5982\u679c\u4f60\u5728 Android \u4e2d\u7528\u8fc7 Google \u7684 FlexboxLayout\uff0c\u5728 iOS \u4e0a\u63a8\u8350\u4f60\u7528 https:\/\/github.com\/layoutBox\/FlexLayout \u8fd9\u4e2a\u5e93\u3002 \u5b83\u662f\u57fa\u4e8e Facebook \u5f00\u6e90\u7684 Flexbox \u5e03\u5c40\u5f15\u64ce Yoga \u5b9e\u73b0\u7684\uff0c\u975e\u5e38\u597d\u7528\u3002\u767e\u5206\u767e\u627e\u56de Android \u4e0a\u7684\u611f\u89c9\u3002iOS \u4e2d\u6709\u4e2a\u53eb UIStackView \u7684\u63a7\u4ef6\u5b9e\u73b0\u4e86\u4e00\u4e9b\u7c7b\u4f3c\u4e8e Flexbox \u7684\u63a7\u4ef6\u7ec4\u7ec7\u65b9\u5f0f\uff0c\u4f46\u662f\u548c\u771f\u6b63\u7684 Flexbox \u8fd8\u662f\u5dee\u7684\u592a\u8fdc\u4e86\u3002<\/p>\n<p>\u4f46\u662f\u8bf4\u5230\u5e95\uff0ciOS \u6700\u597d\u8fd8\u662f\u8981\u7528 Auto Layout \u6765\u5e03\u5c40\uff0c\u56e0\u4e3a\u8fd9\u4e2a\u624d\u662f\u6700 Native \u7684\u5e03\u5c40\u65b9\u5f0f\u3002\u4f60\u7528\u5176\u4ed6\u7684\u5e03\u5c40\u65b9\u5f0f\u4e4b\u524d\uff0c\u81f3\u5c11\u8981\u641e\u6295 Auto Layout \u3002<\/p>\n<p>\u4f60\u6709\u5174\u8da3\u7684\u8bdd\u53ef\u4ee5\u52a0\u6211\u7684 tg \u6211\u7ed9\u4f60\u89e3\u7b54\uff0c\u79fb\u52a8\u7aef\u662f\u6211\u7684\u8001\u672c\u884c\uff0c\u641e\u4e86\u5341\u6765\u5e74\u4e86\uff0c\u5927\u5bb6\u4e92\u76f8\u5b66\u4e60\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981006\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : oko <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u81ea\u52a8\u5e03\u5c40\u8001\u5fc3\u9178\u4e86\uff0c\u65e9\u5df2\u653e\u5f03\uff0c\u6539\u7528\u624b\u52a8\u5e03\u5c40\u4e86\uff0c\u867d\u7136\u70e6\u4e86\u4e00\u70b9\uff0c\u4f46\u662f\u624b\u52a8\u63a7\u5236\u6bcf\u4e00\u4e2a\u50cf\u7d20\u7684\u611f\u89c9\u8fd8\u662f\u5f88\u7f8e\u5999\u7684                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981007\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Sixi <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e3b\u7684\u610f\u601d\u6211\u61c2\uff0c\u4ee5\u524d\u4e5f\u662f\u4ece\u8fd9\u4e9b\u5751\u91cc\u6162\u6162\u722c\u51fa\u6765\u7684\u3002<br \/>\u5047\u5982\u4f7f\u7528 SnapKit \u4e3a\u4e00\u4e2a View \u6dfb\u52a0\u7ea6\u675f\u4e4b\u540e\uff0c\u60f3\u8981\u83b7\u53d6\u8fd9\u4e2a View \u7684 \u5bbd\u9ad8\uff08\u5b9e\u9645\u4e0a\u4e5f\u5c31\u662f frame \u503c\uff09\uff0c\u4f46\u603b\u662f\u662f 0 \u3002\u8fd9\u662f\u56e0\u4e3a\u4f60\u83b7\u53d6\u5bbd\u9ad8\u7684\u4ee3\u7801\u5728\u4f60\u7684 SnapKit \u4ee3\u7801\u524d\u6267\u884c\uff0c\u6b64\u65f6 View \u5e76\u6ca1\u6709\u5e03\u5c40\uff0c\u9ed8\u8ba4\u7684 frame \u503c\u5747\u662f 0\uff0c\u6240\u4ee5\u83b7\u53d6\u4e0d\u5230\u7684\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981008\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : vincentxue <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u6211\u6765\u8865\u5145\u4e00\u4e0b\u4e0a\u7684\u56de\u590d\u3002\u51c6\u786e\u5730\u8bf4\uff0cSnapKit \uff08 Auto Layout \uff09 \u7684\u4ee3\u7801\u53ea\u662f\u63cf\u8ff0\u4e86\u7ea6\u675f\u3002Auto Layout \u76f8\u6bd4\u4f20\u7edf\u7684\u624b\u52a8\u5e03\u5c40\u591a\u4e86\u4e00\u6b65\u66f4\u65b0\u7ea6\u675f\u7684\u64cd\u4f5c\uff0c\u5bf9\u5e94\u7684\u662f updateConstraints \u65b9\u6cd5\uff0c\u7ea6\u675f\u4ee3\u7801\u901a\u5e38\u8981\u653e\u5728\u8fd9\u91cc\u9762\uff0c\u7ea6\u675f\u662f\u4ece\u4e0b\u5230\u4e0a\u7684\uff0c\u6240\u4ee5 super \u662f\u653e\u5728\u6700\u540e\u7684\u3002\u8fd9\u4e2a\u65b9\u6cd5\u88ab\u7cfb\u7edf\u8c03\u7528\u4e4b\u540e\uff0cView \u8fd8\u6ca1\u6709\u5b8c\u6210\u5e03\u5c40\uff0c\u4e5f\u6ca1\u6709 frame \u3002\u76f4\u5230 layoutSubviews \u88ab\u8c03\u7528\uff0c\u8fd9\u4e2a\u65f6\u5019\u7ea6\u675f\u624d\u4f1a\u88ab\u8f6c\u6362\u6210\u5177\u4f53\u7684 frame\uff0c\u5e03\u5c40\u662f\u4ece\u4e0a\u5230\u4e0b\u7684\uff0c\u6240\u4ee5\u8981\u5148\u8c03\u7528 super \u3002Auto Layout \u63a8\u51fa\u4e4b\u524d\uff0c\u90fd\u662f\u8986\u76d6\u8fd9\u4e2a\u65b9\u6cd5\u6765\u5199 frame \u7684\u3002Auto Layout \u63a8\u51fa\u4e4b\u540e\uff0c\u8fd9\u4e2a\u65b9\u6cd5\u4e3b\u8981\u662f\u7528\u6765\u5728\u5e03\u5c40\u5b8c\u6210\u4e4b\u540e\u505a\u4e00\u4e9b\u64cd\u4f5c\u7684\u3002<\/p>\n<p>\u5982\u679c\u4f60\u60f3\u8981\u5728\u5e03\u5c40\u5b8c\u6210\u4e4b\u524d\u62ff\u5230\u4e00\u4e2a View \u7684 size\uff0c\u7cfb\u7edf\u7ed9\u4f60\u63d0\u4f9b\u4e86\u4e09\u4e2a\u65b9\u6cd5\uff0cintrinsicContentSize \u3001sizeThatFits: \u548c systemLayoutSizeFittingSize:\u3002\u8fd9\u4e09\u4e2a\u65b9\u6cd5\u5177\u4f53\u7684\u533a\u522b\u4f60\u53ef\u4ee5\u53bb\u7f51\u4e0a\u67e5\uff0c\u4f46\u662f\u901a\u5e38\u4f60\u90fd\u4e0d\u4f1a\u7528\u5230\u5b83\u4eec\u3002<\/p>\n<p>Auto Layout \u7684\u539f\u7406\u5728 WWDC 2015 \u7684\u65f6\u5019\u6709\u51e0\u8282\u89c6\u9891\u4e13\u95e8\u8bb2\u4e86\uff0c\u4e3b\u6709\u5174\u8da3\u53ef\u4ee5\u53bb\u627e\u627e\u770b\u4e00\u4e0b\u3002<\/p>\n<p>\u6211\u5e2e\u4f60\u627e\u597d\u4e86\u3002https:\/\/developer.apple.com\/videos\/all-videos\/?q=auto%20layout<\/p>\n<p>\u5982\u679c\u4f60\u89c9\u5f97 Auto Layout \u5b9e\u5728\u662f\u592a\u9ebb\u70e6\u4e86\uff0c\u4f60\u4e5f\u53ef\u4ee5\u7528\u6211\u521a\u624d\u8bf4\u7684\u90a3\u4e2a\u5f00\u6e90\u4e86 FlexLayout \u7684 layoutBox \u7684\u53e6\u4e00\u4e2a\u53eb PinLayout \u7684\u5e93\u3002\u5b83\u662f\u4e00\u4e2a\u7528 Auto Layout \u7684\u8bed\u6cd5\u53bb\u76f4\u63a5\u64cd\u4f5c frame \u7684\u5e93\uff0c\u6ca1\u6709\u4efb\u4f55\u7ea6\u675f\uff0c\u548c\u76f4\u63a5\u64cd\u4f5c frame \u6ca1\u6709\u533a\u522b\u3002\u8fd9\u4e9b\u5e03\u5c40\u5e93\u90fd\u662f\u53ef\u4ee5\u6df7\u7528\u7684\uff0c\u4f60\u53ef\u4ee5\u4e00\u4e2a View \u7528 Auto Layout\uff0c\u53e6\u4e00\u4e2a View \u7528 FlexLayout\uff0c\u518d\u4e00\u4e2a View \u7528 PinLayout \u3002layoutBox \u4e0b\u7684\u4e24\u4e2a\u5e93\u6211\u90fd\u662f\u4e00\u76f4\u5728\u7528\u7684\uff0c\u5199\u4e86\u597d\u51e0\u4e2a\u5341\u4e07\u884c\u4ee5\u4e0a\u4ee3\u7801\u7684\u5546\u4e1a App\uff0c\u6ca1\u6709\u4efb\u4f55\u95ee\u9898\uff0c\u975e\u5e38\u7684\u7a33\u5b9a\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981009\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Roccc <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u767e\u5206\u6bd4+SnapKit                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981010\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : magic3584 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             1. \u81ea\u9002\u5e94\u53ef\u4ee5<br \/>&#8220;&#8220; objective-c <br \/>view1.snp_makeConstraints { make in<br \/> make.height.equalTo(view2).dividedBy(2)<br \/>}<br \/>&#8220;&#8220;<\/p>\n<p>2. \u83b7\u53d6 frame \u4e4b\u524d\u5148\u8c03\u7528<br \/>superView.setNeedLayout()<br \/>superView.layoutIfNeeded()                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981011\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : magic3584 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e0a code block \u6807\u8bb0 OC \u4f46\u5b9e\u9645\u5199\u7684 swift&#8230;                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981012\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : expkzb <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u201c\u6211\u5728\u7f51\u4e0a\u641c\u4e86\u7528 SnapKit \u7684\u65b9\u5f0f\u53ef\u4ee5\u4e0d\u8bbe\u7f6e\u63a7\u4ef6\u7684\u9ad8\u5bbd\u6765\u4f7f\u7528\uff0c\u8fd9\u4e2a\u7b97\u662f\u4e00\u79cd\u65b9\u5f0f\uff0c\u4f46\u662f\u7528\u4e86\u8fd9\u4e2a\u65b9\u5f0f\u4e4b\u540e\uff0c\u83b7\u53d6\u63a7\u4ef6\u7684\u9ad8\u5bbd\u6709\u65f6\u5019\u4e3a 0\uff0c\u597d\u50cf\u662f\u56e0\u4e3a snapKit \u662f\u5f02\u6b65\u7684\u539f\u56e0\uff0c\u592a\u75db\u82e6\u4e86\uff0c\u6709\u65f6\u5019\u5c31\u662f\u9700\u8981\u9ad8\u5bbd\u4f46\u662f\u83b7\u53d6\u4e0d\u5230\u201d<\/p>\n<p>&#8212; \u5982\u679c\u786e\u5b9e\u9700\u8981\u83b7\u53d6\u5bbd\u9ad8\uff0c\u6267\u884c\u4e00\u4e0b layoutIfNeeded\uff0c\u5728\u540e\u9762\u5e94\u8be5\u5c31\u53ef\u4ee5\u83b7\u53d6\u5230\u5bbd\u9ad8\u4e86\u3002\u53ef\u80fd\u4e5f\u6709\u4e9b\u7ec6\u8282\u6211\u6ca1\u63d0\uff0c\u597d\u4e45\u6ca1\u641e\u4e86\u3002<\/p>\n<p>&#8220;\u7136\u540e\u8fd8\u6709\u4e2a\u95ee\u9898\u5c31\u662f\u63a7\u4ef6\u7684\u9ad8\u5bbd\u6839\u636e\u5185\u5bb9\u81ea\u9002\u5e94\uff0c\u6211\u611f\u89c9\u8fd9\u4e2a\u662f\u6700\u5934\u75db\u7684\uff0c\u4e0a\u9762\u7684 snapkit \u662f\u548c\u7236\u5e03\u5c40\u7684\u9ad8\u5bbd\u62c9\u4f38\uff0c\u4f46\u662f\u6709\u65f6\u5019\u6211\u60f3\u6839\u636e\u5b50\u63a7\u4ef6\u5185\u5bb9\u81ea\u52a8\u9002\u5e94\u9ad8\u5bbd\u600e\u4e48\u5f04\u5440&#8221;<\/p>\n<p>&#8212; \u4f60\u4e0d\u6307\u5b9a\u7236\u89c6\u56fe\u7684\u5bbd\u9ad8\u7ea6\u675f\u5c31\u884c\uff0c\u81ea\u7136\u4f1a\u88ab\u5b50\u89c6\u56fe\u7684\u7ea6\u675f\u6491\u8d77\u6765\u3002<\/p>\n<p>\u81ea\u52a8\u5e03\u5c40\u5f88\u597d\u7528\uff0c\u4e00\u5b9a\u8981\u591a\u7ec3\u4e60\uff0c\u638c\u63e1\u5b83\u7684\u601d\u7ef4\u65b9\u5f0f\u3002\u552f\u4e00\u503c\u5f97\u8bdf\u75c5\u7684\u662f\u6539\u8d77\u6765\u6bd4\u8f83\u5934\u75bc\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981013\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : loarland <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u63a7\u4ef6\u81ea\u8eab\u7ea6\u675f\u8981\u5b8c\u6574\uff0c\u4e92\u76f8\u4e4b\u95f4\u7684\u4f18\u5148\u7ea7\u4e5f\u8981\u8c03\u6574                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981014\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : 365473321 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5176\u5b9e AutoLayout \u7684\u521d\u8877\u5c31\u662f\u8981\u4f60\u5fd8\u6389 Frame \u5e03\u5c40\uff0c\u8bbe\u7f6e\u597d\u7ea6\u675f\uff0c\u5269\u4e0b\u7684\u5de5\u4f5c\u5c31\u4ea4\u7ed9 AutoLayout Engine \u5c31\u597d\u5566<br \/>\u5982\u679c\u4f60\u60f3\u8981\u7acb\u523b\u83b7\u53d6\u5230 frame\uff0c\u4f60\u9700\u8981\u8c03\u7528\u4e24\u4e2a\u65b9\u6cd5<br \/>setNeedsLayout()<br \/>layoutIfNeeded()<\/p>\n<p>let subView = UIView(frame: .zero)<br \/>view.addSubview(subView)<br \/>subView.snp.makeConstraints { make in<br \/> make.top.left.equalToSuperview()<br \/> make.size.equalTo(300)<br \/>}<br \/>subView.setNeedsLayout()<br \/>subView.layoutIfNeeded()<br \/>print(subView.frame)                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981015\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Freeego <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u4e00\u822c\u6765\u8bf4\u67d0\u4e2a\u63a7\u4ef6\u7528\u4e86 AutoLayout \u5c31\u4e0d\u9700\u8981\u518d\u83b7\u53d6 frame \u4e86\uff0c\u8fd9\u4e5f\u662f AutoLayout \u7684\u76ee\u7684\uff0c\u5982\u679c\u4e00\u5b9a\u8981\u83b7\u53d6\u7684\u8bdd\u5c31\u5728\u7ea6\u675f\u4e4b\u540e\u8c03\u7528\u7236\u63a7\u4ef6\u7684 layoutIfNeeded()<\/p>\n<p>\u7236\u63a7\u4ef6\u6839\u636e\u5b50\u63a7\u4ef6\u81ea\u9002\u5e94\u5bbd\u9ad8\uff0c\u4e00\u53e5\u8bdd\u5c31\u662f\u901a\u8fc7\u5b50\u63a7\u4ef6\u7684\u7ea6\u675f\u8ba1\u7b97\u51fa\u7236\u63a7\u4ef6\u7684\u5927\u5c0f\uff0c\u7236\u63a7\u4ef6\u672c\u8eab\u4e0d\u8bbe\u7f6e\u5bbd\u9ad8\u9650\u5236\u3002\u591a\u7ec3\u4e60\u51e0\u6b21\u4ee5\u540e\u5c31\u4f1a\u719f\u7ec3\u4e86\uff0c\u53ea\u8981\u4f60\u5728\u5199\u5b8c\u5b50\u63a7\u4ef6\u7684\u7ea6\u675f\u4ee5\u540e\uff0c\u80fd\u591f\u4ece\u4e2d\u63a8\u7b97\u51fa\u7236\u63a7\u4ef6\u7684 contentSize \u5c31\u884c\uff0c\u5c31\u50cf\u89e3\u65b9\u7a0b\u4e00\u6837\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981016\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Jackiehu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u56e0\u4e3a\u662f\u5f02\u6b65\u7ed8\u5236\uff0c\u9700\u8981\u5728\u4f60\u83b7\u53d6\u6700\u7ec8 frame \u524d layoutifneeded                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981017\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Jackiehu <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             autolayout \u5c31\u662f\u7b49 layoutsubviews \u540e\u624d\u6709\u7684 frame\uff0clayoutifneeded \u4f1a\u8ba9 view \u7acb\u5373\u7ed8\u5236\uff0c\u6240\u4ee5\u5728\u4e4b\u540e\u53ef\u4ee5\u62ff\u5230\u5927\u5c0f\u5bbd\u9ad8                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981018\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : 365473321 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @365473321 \u5b50\u89c6\u56fe\u8c03\u7528\u8fd9\u4e24\u4e2a\u65b9\u6cd5\u53ef\u4ee5\u786e\u5b9a\u5b50\u89c6\u56fe\u7684 size\uff0c\u7236\u89c6\u56fe\u8c03\u7528\u8fd9\u4e24\u4e2a\u65b9\u6cd5\u53ef\u4ee5\u786e\u5b9a\u5b50\u89c6\u56fe\u7684 frame                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981019\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : xhpan10 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u901a\u8fc7\u7ea6\u675f\u6761\u4ef6\u8fd8\u6709\u81ea\u5b9a\u4e49 View \u7684 content size \u6765\u505a\u9002\u914d\u554a                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981020\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Xcution <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Freeego @expkzb \u6211\u5c31\u662f\u9047\u5230\u8fd9\u79cd\u95ee\u9898\uff0c\u6bd4\u5982\u8bf4\u6211\u7528 UICollectionView,\u663e\u793a\u7684\u7f51\u683c\u72b6\u7684\uff0c\u6709\u65f6\u5019\u6709 5 \u6392\u6570\u636e\uff0c\u6709\u65f6\u5019\u6709 6 \u6392\u6570\u636e\uff0c\u5982\u679c\u6211\u4e0d\u8bbe\u7f6e UICollectionView \u7684\u9ad8\u5ea6\u5185\u5bb9\u5c31\u663e\u793a\u4e0d\u51fa\u6765\uff0c\u4f46\u662f\u8bbe\u7f6e\u6211\u53c8\u4e0d\u77e5\u9053\u8be5\u8bbe\u7f6e\u591a\u5c11\uff0c\u8fd8\u6709\u79cd\u5c31\u662f\u77e5\u9053\u6bcf\u4e2a cell \u7684\u9ad8\u5ea6\u6765\u7b97\u9ad8\u5ea6\u8fdb\u884c\u8bbe\u7f6e\uff0c\u8fd9\u79cd\u4e5f\u884c\uff0c\u4f46\u662f\u4e07\u4e00\u6211 cell \u7684\u9ad8\u5ea6\u4e5f\u662f\u52a8\u6001\u7684\u5566\uff0c\u8981\u8ba1\u7b97 cell \u7684\u9ad8\u5ea6\u5c31\u8981\u663e\u793a\u51fa\u6765\u624d\u80fd\u8ba1\u7b97\uff0c\u4e0d\u8bbe\u7f6e UICollectionView \u7684\u9ad8\u5ea6\u6709\u663e\u793a\u4e0d\u51fa\u6765\uff0c\u6240\u4ee5\u5c31\u5fc5\u987b\u8981\u8bbe\u7f6e UICollectionView \u7684\u9ad8\u5ea6\uff0c\u4f46\u662f\u56e0\u4e3a\u662f\u52a8\u6001\u7684\u6211\u53c8\u4e0d\u77e5\u9053\u8be5\u8bbe\u7f6e\u591a\u5c11                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"4981021\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Freeego <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Xcution \u4f60\u8bf4\u7684\u5e94\u8be5\u662f UICollectionView \u7684 contentSize \u5427\uff0cframe \u5728\u521d\u59cb\u5316\u7684\u65f6\u5019\u5c31\u5199\u6b7b\u4e86\uff0c\u91cc\u9762\u7684\u5185\u5bb9\u591a\u4e86\u5c11\u4e86\u5f71\u54cd\u7684\u90fd\u662f contentSize \u3002\u800c\u4e14 UICollectionView \u7684 contentSize \u90fd\u662f\u81ea\u52a8\u7684\uff0c\u5b83\u5c31\u662f\u4e2a UIScrollView \u7684\u5b50\u7c7b\uff0c\u6bd4\u5982\u6570\u636e\u591a\u4e86 contentSize \u5c31\u4f1a\u53d8\u5927\uff0c\u5982\u679c\u8303\u56f4\u8d85\u8fc7 collectionView \u7684 frame.size \u4e86\u5c31\u53ef\u4ee5\u6ed1\u52a8\uff0c\u4e0d\u9700\u8981\u81ea\u5df1\u53bb\u6539 contentSize \u3002<\/p>\n<p>\u5982\u679c\u53c8\u8981\u7f51\u683c\u5e03\u5c40 cell \u9ad8\u5ea6\u53c8\u8981\u52a8\u6001\u53d8\u5316\uff0c\u90a3\u5c31\u662f\u7011\u5e03\u6d41\u4e86\uff0c\u8981\u91cd\u5199\u4e00\u4e2a layout \u624d\u53ef\u4ee5\u5b9e\u73b0\u3002<\/p>\n<p>\u4e0d\u77e5\u9053\u4f60\u8bf4\u7684\u4e0d\u8bbe\u7f6e UICollectionView \u7684\u9ad8\u5ea6\u5185\u5bb9\u5c31\u4e0d\u663e\u793a\u662f\u4ec0\u4e48\u610f\u601d\uff0c\u662f\u4e0d\u662f layout \u7684 itemSize \u6ca1\u6709\u5199\u5bf9\uff1f\u4e0d\u5e94\u8be5\u6709&#8221;\u8bbe\u7f6e UICollectionView \u7684\u9ad8\u5ea6&#8221;\u8fd9\u79cd\u505a\u6cd5\uff0cframe \u548c\u5185\u5bb9\u65e0\u5173\uff0ccontentSize \u662f\u81ea\u52a8\u7684\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u6700\u8fd1\u521a\u521a\u5f00\u59cb IOS \u5f00\u53d1\uff0c\u4f7f\u7528\u7684&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/323583"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=323583"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/323583\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=323583"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=323583"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=323583"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}