{"id":3699,"date":"2023-08-14T14:52:43","date_gmt":"2023-08-14T06:52:43","guid":{"rendered":"https:\/\/www.zhidianwl.net\/zhidianwl\/?p=3699"},"modified":"2023-08-14T14:52:43","modified_gmt":"2023-08-14T06:52:43","slug":"app%e5%bc%80%e5%8f%91view%e6%a1%86%e6%9e%b6%e6%9c%89%e9%82%a3%e4%ba%9b%e5%a5%bd%e5%a4%84%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/www.zhidianwl.net\/zhidianwl\/2023\/08\/14\/app%e5%bc%80%e5%8f%91view%e6%a1%86%e6%9e%b6%e6%9c%89%e9%82%a3%e4%ba%9b%e5%a5%bd%e5%a4%84%ef%bc%9f\/","title":{"rendered":"app\u5f00\u53d1view\u6846\u67b6\u6709\u90a3\u4e9b\u597d\u5904\uff1f"},"content":{"rendered":"

App\u5f00\u53d1View\u6846\u67b6\uff1a\u539f\u7406\u548c\u8be6\u7ec6\u4ecb\u7ecd<\/p>\n

\u5728App\u5f00\u53d1\u4e2d\uff0c\u4e00\u4e2a\u5e38\u89c1\u7684\u6311\u6218\u662f\u5982\u4f55\u6709\u6548\u5730\u6784\u5efa\u7528\u6237\u754c\u9762\u3002View\u6846\u67b6\uff08\u53c8\u79f0UI\u6846\u67b6\uff09\u662f\u5e2e\u52a9\u6784\u5efaApp\u7528\u6237\u754c\u9762\u7684\u4e00\u79cd\u65b9\u6cd5\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u79cd\u7b80\u5355\u3001\u6e05\u6670\u7684\u7ed3\u6784\u6765\u521b\u5efa\u548c\u7ba1\u7406UI\u7ec4\u4ef6\u3002\u672c\u6587\u5c06\u5bf9View\u6846\u67b6\u7684\u539f\u7406\u8fdb\u884c\u8be6\u7ec6\u4ecb\u7ecd\uff0c\u5e76\u63a2\u8ba8\u5176\u5728App\u5f00\u53d1\u4e2d\u7684\u5e94\u7528\u3002<\/p>\n

1. View\u6846\u67b6\u539f\u7406<\/p>\n

View\u6846\u67b6\u7684\u6838\u5fc3\u6982\u5ff5\u662f\u5c06App\u7684UI\u5206\u4e3a\u4e24\u90e8\u5206\uff1a\u89c6\u56fe\uff08View\uff09\u548c\u89c6\u56fe\u63a7\u5236\u5668\uff08View Controller\uff09\u3002\u89c6\u56fe\u662f\u8d1f\u8d23\u663e\u793a\u5185\u5bb9\u7684UI\u7ec4\u4ef6\uff0c\u5982\u6587\u672c\u3001\u56fe\u50cf\u3001\u6309\u94ae\u7b49\u3002\u89c6\u56fe\u63a7\u5236\u5668\u5219\u8d1f\u8d23\u7ba1\u7406\u89c6\u56fe\uff0c\u5305\u62ec\u5904\u7406\u7528\u6237\u8f93\u5165\u3001\u66f4\u65b0UI\u548c\u5904\u7406\u89c6\u56fe\u4e4b\u95f4\u7684\u5207\u6362\u3002<\/p>\n

a) \u89c6\u56fe\u5c42\u6b21\u7ed3\u6784<\/p>\n

\u5728View\u6846\u67b6\u4e2d\uff0c\u89c6\u56fe\u53ef\u4ee5\u5d4c\u5957\u5728\u5176\u4ed6\u89c6\u56fe\u4e4b\u5185\uff0c\u5f62\u6210\u4e00\u4e2a\u89c6\u56fe\u5c42\u6b21\u7ed3\u6784\u3002\u6bcf\u4e2a\u89c6\u56fe\u90fd\u6709\u4e00\u4e2a\u6216\u591a\u4e2a\u5b50\u89c6\u56fe\uff0c\u800c\u6bcf\u4e2a\u5b50\u89c6\u56fe\u90fd\u6709\u4e00\u4e2a\u7236\u89c6\u56fe\u3002\u8fd9\u79cd\u7ed3\u6784\u4f7f\u5f97\u5f00\u53d1\u4eba\u5458\u53ef\u4ee5\u8f7b\u677e\u5730\u7ec4\u7ec7\u548c\u7ba1\u7406UI\u7ec4\u4ef6\uff0c\u540c\u65f6\u65b9\u4fbf\u5730\u7ba1\u7406\u89c6\u56fe\u7684\u663e\u793a\u548c\u9690\u85cf\u3002<\/p>\n

b) \u89c6\u56fe\u63a7\u5236\u5668<\/p>\n

\u89c6\u56fe\u63a7\u5236\u5668\u662fView\u6846\u67b6\u7684\u6838\u5fc3\u7ec4\u4ef6\u3002\u5b83\u8d1f\u8d23\u7ba1\u7406\u89c6\u56fe\u5c42\u6b21\u7ed3\u6784\u4e2d\u7684\u89c6\u56fe\uff0c\u4fc3\u8fdb\u89c6\u56fe\u4e4b\u95f4\u7684\u5207\u6362\uff0c\u5e76\u5904\u7406\u7528\u6237\u4ea4\u4e92\u4e8b\u4ef6\u3002\u89c6\u56fe\u63a7\u5236\u5668\u5305\u62ec\u4ee5\u4e0b\u529f\u80fd\uff1a<\/p>\n

– \u751f\u547d\u5468\u671f\u7ba1\u7406\uff1a\u521d\u59cb\u5316\u89c6\u56fe\u3001\u52a0\u8f7d\u89c6\u56fe\u3001\u89c6\u56fe\u663e\u793a\/\u6d88\u5931\u7684\u901a\u77e5\u7b49\uff1b<\/p>\n

– \u7528\u6237\u4ea4\u4e92\u5904\u7406\uff1a\u54cd\u5e94\u89e6\u6478\u4e8b\u4ef6\u3001\u624b\u52bf\u8bc6\u522b\u3001\u6309\u94ae\u70b9\u51fb\u7b49\uff1b<\/p>\n

– \u89c6\u56fe\u5bfc\u822a\uff1a\u63a8\u9001\u548c\u5f39\u51fa\u89c6\u56fe\u3002<\/p>\n

2. \u5e38\u89c1\u7684View\u6846\u67b6\u5e94\u7528<\/p>\n

\u4e0d\u540c\u64cd\u4f5c\u7cfb\u7edf\u548c\u5e94\u7528\u5f00\u53d1\u5e73\u53f0\u4f7f\u7528\u4e0d\u540c\u7684\u5b9e\u73b0View\u6846\u67b6\u7684\u7c7b\u5e93\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u89c1\u7684View\u6846\u67b6\uff1a<\/p>\n

a) iOS\u548cmacOS\uff1aUIKit\u548cAppKit<\/p>\n

iOS\u548cmacOS\u5e73\u53f0\u4f7f\u7528\u7684APP\u5f00\u53d1<\/a>View\u6846\u67b6\u88ab\u79f0\u4e3aUIKit\uff08iOS\uff09\u548cAppKit\uff08macOS\uff09\u3002\u5b83\u4eec\u4e3a\u5f00\u53d1\u8005\u63d0\u4f9b\u4e86\u5927\u91cf\u7528\u4e8e\u521b\u5efa\u548c\u7ba1\u7406UI\u754c\u9762\u7684\u7c7b\u548c\u65b9\u6cd5\u3002\u5176\u4e2d\uff0cUIView\u662f\u89c6\u56fe\u7684\u57fa\u7c7b\uff0c\u800cUIViewController\u662f\u89c6\u56fe\u63a7\u5236\u5668\u7684\u57fa\u7c7b\u3002<\/p>\n

b) Android\uff1aView\u548cViewGroup<\/p>\n

\u5728Android\u5e73\u53f0\uff0cView\u6846\u67b6\u7531View\u7c7b\u548cViewGroup\u7c7b\u7ec4\u6210\u3002View\u662f\u6240\u6709UI\u7ec4\u4ef6\u7684\u57fa\u7c7b\uff0c\u5305\u62ecTextView\u3001ImageView\u3001Button\u7b49\u3002ViewGroup\u5219\u662f\u7528\u4e8e\u7ba1\u7406\u5b50\u89c6\u56fe\u7684\u5bb9\u5668\u7c7b\uff0c\u4f8b\u5982LinearLayout\u3001RelativeLayout\u7b49\u3002<\/p>\n

c) React Native\uff1aReact\u548cReact Navigation<\/p>\n

React Native\u662f\u4e00\u4e2a\u7528\u4e8e\u6784\u5efa\u8de8\u5e73\u53f0\u79fb\u52a8\u5e94\u7528\u7684\u5f00\u53d1\u6846\u67b6\uff0c\u5b83\u4f7fAPP<\/a>\u7528React\u8fdb\u884c\u754c\u9762\u63cf\u8ff0\u548c\u72b6\u6001\u7ba1\u7406\uff0c\u901a\u8fc7React Navigation\u5e93\u5b9e\u73b0\u89c6\u56fe\u63a7\u5236\u5668\u548c\u5bfc\u822a\u7684\u529f\u80fd<\/p>\n

<\/figure>\n<\/p>\n

\u3002<\/p>\n

\u7ed3\u8bba<\/p>\n

View\u6846\u67b6\u4f5c\u4e3aApp\u5f00\u53d1\u4e2d\u4e00\u4e2a\u5173\u952e\u7684UI\u6784\u5efa\u65b9\u6cd5\uff0c\u4e3a\u5f00\u53d1\u8005\u63d0\u4f9b\u4e86\u4e00\u79cd\u7b80\u5355\u3001\u9ad8\u6548\u7684\u65b9\u5f0f\u6765\u521b\u5efa\u548c\u7ba1\u7406\u7528\u6237\u754c\u9762\u3002\u901a\u8fc7\u5bf9\u89c6\u56fe\u548c\u89c6\u56fe\u63a7\u5236\u5668\u7684\u5206\u79bb\uff0c\u4ee5\u53ca\u89c6\u56fe\u5c42\u6b21\u7ed3\u6784\u7684\u7ec4\u7ec7\uff0cView\u6846\u67b6\u80fd\u591f\u4f7f\u5f00\u53d1\u8005\u4e13\u6ce8\u4e8eUI\u8bbe\u8ba1\u548c\u4ea4\u4e92\u7684\u5b9e\u73b0\uff0c\u800c\u4e0d\u5fc5\u9677\u5165\u590d\u6742\u7684UI\u903b\u8f91\u3002\u65e0\u8bba\u662f\u539f\u751fApp\u8fd8\u662f\u8de8\u5e73\u53f0\u79fb\u52a8\u5e94\u7528\uff0cView\u6846\u67b6\u90fd\u88ab\u5e7f\u6cdb\u5e94\u7528\u4e8e\u5404\u79cd\u5f00\u53d1\u573a\u666f\uff0c\u5c55\u73b0\u51fa\u5176\u5f3a\u5927\u7684\u7075\u6d3b\u6027\u548c\u6613\u7528\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"

App\u5f00\u53d1View\u6846\u67b6\uff1a\u539f\u7406\u548c\u8be6\u7ec6\u4ecb\u7ecd\u5728App\u5f00\u53d1\u4e2d\uff0c\u4e00\u4e2a\u5e38\u89c1\u7684\u6311\u6218\u662f\u5982\u4f55\u6709\u6548\u5730\u6784\u5efa\u7528\u6237\u754c\u9762\u3002View\u6846\u67b6\uff08\u53c8\u79f0UI\u6846\u67b6\uff09\u662f\u5e2e\u52a9\u6784\u5efaApp\u7528\u6237\u754c\u9762\u7684\u4e00\u79cd\u65b9\u6cd5\uff0c\u5b83\u63d0\u4f9b\u4e86\u4e00\u79cd\u7b80\u5355\u3001\u6e05\u6670\u7684\u7ed3\u6784\u6765\u521b\u5efa\u548c\u7ba1\u7406<\/p>\n","protected":false},"author":9,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[7332,2772,4456,268,812],"topic":[],"class_list":["post-3699","post","type-post","status-publish","format-standard","hentry","category-kaifaapp","tag-7332","tag-app","tag-4456","tag-268","tag-812"],"_links":{"self":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/3699","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/users\/9"}],"replies":[{"embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/comments?post=3699"}],"version-history":[{"count":0,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/posts\/3699\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/media?parent=3699"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/categories?post=3699"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/tags?post=3699"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.zhidianwl.net\/zhidianwl\/wp-json\/wp\/v2\/topic?post=3699"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}