{"id":4005,"date":"2025-05-29T13:25:18","date_gmt":"2025-06-04T06:05:18","guid":{"rendered":"https:\/\/badgameshow.com\/steven\/?p=4005"},"modified":"2025-06-04T13:25:18","modified_gmt":"2025-06-04T06:05:18","slug":"%e5%ad%b8%e7%bf%92%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8swift%e4%b8%ad%e7%9a%84%e5%88%86%e5%89%b2%e8%a7%86%e5%9b%be","status":"publish","type":"post","link":"https:\/\/badgameshow.com\/steven\/swift\/%e5%ad%b8%e7%bf%92%e5%a6%82%e4%bd%95%e4%bd%bf%e7%94%a8swift%e4%b8%ad%e7%9a%84%e5%88%86%e5%89%b2%e8%a7%86%e5%9b%be\/","title":{"rendered":"\u638c\u63e1Swift\u4e2d\u7684UISplitViewController\uff1a\u6253\u9020\u6d41\u66a2\u7684\u5206\u5272\u8996\u5716\u61c9\u7528"},"content":{"rendered":"<p><meta name=\"keywords\" content=\"Swift, UISplitViewController, \u5206\u5272\u89c6\u56fe, iOS\u5f00\u53d1, macOS\u5e94\u7528\"><\/p>\n<h1>\u638c\u63e1Swift\u4e2d\u7684UISplitViewController\uff1a\u6253\u9020\u6d41\u66a2\u7684\u5206\u5272\u8996\u5716\u61c9\u7528<\/h1>\n<p>Swift\u662f\u4e00\u7a2e\u529f\u80fd\u5f37\u5927\u4e14\u5ee3\u6cdb\u4f7f\u7528\u7684\u7a0b\u5f0f\u8a9e\u8a00\uff0c\u5c08\u70baiOS\u548cmacOS\u61c9\u7528\u7a0b\u5f0f\u958b\u767c\u800c\u8a2d\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e\u5982\u4f55\u4f7f\u7528UISplitViewController\u985e\u5225\u4f86\u5be6\u73fe\u512a\u96c5\u7684\u5206\u5272\u8996\u5716\uff0c\u8b93\u60a8\u7684\u61c9\u7528\u7a0b\u5f0f\u5728\u4e0d\u540c\u8a2d\u5099\u4e0a\u90fd\u80fd\u63d0\u4f9b\u5353\u8d8a\u7684\u7528\u6236\u9ad4\u9a57\u3002<\/p>\n<h2>\u4ec0\u9ebc\u662f\u5206\u5272\u8996\u5716\uff1f<\/h2>\n<p>\u5206\u5272\u8996\u5716\u662fiOS\u61c9\u7528\u7a0b\u5f0f\u8a2d\u8a08\u4e2d\u7684\u4e00\u500b\u91cd\u8981\u6982\u5ff5\uff0c\u80fd\u5920\u5c07\u61c9\u7528\u7a0b\u5f0f\u7684\u754c\u9762\u5206\u70ba\u5169\u500b\u90e8\u5206\uff0c\u4e26\u5141\u8a31\u7528\u6236\u5728\u9019\u5169\u500b\u90e8\u5206\u4e4b\u9593\u8f15\u9b06\u5207\u63db\u3002\u9019\u7a2e\u8a2d\u8a08\u5728iPad\u4e0a\u5c24\u5176\u6d41\u884c\uff0c\u56e0\u70ba\u5b83\u53ef\u4ee5\u5728\u5de6\u53f3\u5169\u5074\u986f\u793a\u4e0d\u540c\u7684\u5167\u5bb9\uff1b\u800c\u5728iPhone\u4e0a\uff0c\u5247\u53ef\u4ee5\u5728\u4e0a\u4e0b\u5169\u5074\u986f\u793a\uff0c\u5f9e\u800c\u63d0\u5347\u4e86\u7528\u6236\u7684\u64cd\u4f5c\u9748\u6d3b\u6027\u3002<\/p>\n<h2>\u5982\u4f55\u4f7f\u7528UISplitViewController\u985e\u5225\u5be6\u73fe\u5206\u5272\u8996\u5716\uff1f<\/h2>\n<p>UISplitViewController\u985e\u5225\u662fiOS\u958b\u767c\u4e2d\u5be6\u73fe\u5206\u5272\u8996\u5716\u7684\u6838\u5fc3\u5de5\u5177\u3002\u4ee5\u4e0b\u662f\u4f7f\u7528UISplitViewController\u7684\u57fa\u672c\u6b65\u9a5f\uff1a<\/p>\n<ul>\n<li><strong>\u5275\u5efaUISplitViewController\u5c0d\u8c61\uff1a<\/strong>\u9996\u5148\uff0c\u60a8\u9700\u8981\u5275\u5efa\u4e00\u500bUISplitViewController\u5c0d\u8c61\uff0c\u4e26\u5c07\u5176\u8a2d\u7f6e\u70ba\u61c9\u7528\u7a0b\u5f0f\u7684\u6839\u8996\u5716\u63a7\u5236\u5668\u3002<\/li>\n<li><strong>\u8a2d\u7f6e\u4e3b\u8996\u5716\u548c\u526f\u8996\u5716\uff1a<\/strong>\u63a5\u4e0b\u4f86\uff0c\u8a2d\u7f6eUISplitViewController\u7684\u4e3b\u8996\u5716\u548c\u526f\u8996\u5716\uff0c\u4e26\u5c07\u5b83\u5011\u6dfb\u52a0\u70ba\u5b50\u8996\u5716\u63a7\u5236\u5668\u3002<\/li>\n<li><strong>\u8abf\u6574\u5206\u5272\u6bd4\u4f8b\uff1a<\/strong>\u6700\u5f8c\uff0c\u6839\u64da\u9700\u6c42\u8abf\u6574UISplitViewController\u7684\u5206\u5272\u6bd4\u4f8b\uff0c\u4ee5\u63a7\u5236\u4e3b\u8996\u5716\u548c\u526f\u8996\u5716\u7684\u76f8\u5c0d\u5927\u5c0f\u3002<\/li>\n<\/ul>\n<h2>Swift\u7a0b\u5f0f\u78bc\u793a\u4f8b\uff1a\u4f7f\u7528UISplitViewController\u5be6\u73fe\u5206\u5272\u8996\u5716<\/h2>\n<p>\u4ee5\u4e0b\u662f\u4e00\u500b\u7c21\u55ae\u7684\u7a0b\u5f0f\u78bc\u793a\u4f8b\uff0c\u5c55\u793a\u4e86\u5982\u4f55\u4f7f\u7528UISplitViewController\u4f86\u5275\u5efa\u5206\u5272\u8996\u5716\uff1a<\/p>\n<pre class=\"brush: swift\">\n\/\/ \u5275\u5efaUISplitViewController\u5c0d\u8c61\nlet splitViewController = UISplitViewController()\n\n\/\/ \u8a2d\u7f6e\u4e3b\u8996\u5716\u548c\u526f\u8996\u5716\nlet masterViewController = UIViewController()\nlet detailViewController = UIViewController()\nsplitViewController.viewControllers = [masterViewController, detailViewController]\n\n\/\/ \u8a2d\u7f6e\u5206\u5272\u6bd4\u4f8b\nsplitViewController.preferredDisplayMode = .allVisible\n<\/pre>\n<p>\u4e0a\u9762\u7684\u7a0b\u5f0f\u78bc\u793a\u4f8b\u5c55\u793a\u4e86\u5982\u4f55\u5275\u5efa\u4e00\u500bUISplitViewController\u5c0d\u8c61\uff0c\u4e26\u8a2d\u7f6e\u5176\u4e3b\u8996\u5716\u548c\u526f\u8996\u5716\uff0c\u5f9e\u800c\u5be6\u73fe\u5206\u5272\u8996\u5716\u7684\u529f\u80fd\u3002<\/p>\n<h2>\u7d50\u8ad6<\/h2>\n<p>\u672c\u6587\u8a73\u7d30\u4ecb\u7d39\u4e86\u5982\u4f55\u4f7f\u7528Swift\u4e2d\u7684UISplitViewController\u985e\u5225\u4f86\u5be6\u73fe\u5206\u5272\u8996\u5716\u3002\u900f\u904e\u6b64\u65b9\u6cd5\uff0c\u60a8\u53ef\u4ee5\u8f15\u9b06\u5730\u70ba\u60a8\u7684\u61c9\u7528\u7a0b\u5f0f\u5275\u5efa\u4e00\u500b\u6d41\u66a2\u4e14\u591a\u529f\u80fd\u7684\u7528\u6236\u754c\u9762\uff0c\u7121\u8ad6\u662f\u5728iPad\u9084\u662fiPhone\u4e0a\uff0c\u90fd\u80fd\u63d0\u4f9b\u512a\u8cea\u7684\u4f7f\u7528\u9ad4\u9a57\u3002\u958b\u59cb\u5be6\u8e10\u9019\u4e9b\u6280\u5de7\uff0c\u8b93\u60a8\u7684\u61c9\u7528\u7a0b\u5f0f\u66f4\u5177\u5438\u5f15\u529b\u5427\uff01<\/p>\n<p>&#8212;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u6587\u7ae0\u6458\u8981\uff1a\u672c\u6587\u5c07\u4ecb\u7d39\u5982\u4f55\u4f7f\u7528Swift\u4e2d\u7684\u5206\u5272\u89c6\u56fe\uff0c\u5305\u62ec\u5982\u4f55\u4f7f\u7528UISplitViewController\u7c7b\u4f86\u5be6\u73fe\u5206\u5272\u89c6\u5716\uff0c\u5982\u4f55\u8a2d\u7f6e\u5206\u5272\u89c6\u5716\u7684\u4e3b\u8996\u5716\u548c\u526f\u8996\u5716\u7b49\u3002<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[174,5],"tags":[173,9],"class_list":["post-4005","post","type-post","status-publish","format-standard","hentry","category-ios","category-swift","tag-ios","tag-swift"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_shortlink":"https:\/\/wp.me\/pcFK27-12B","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4005","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/comments?post=4005"}],"version-history":[{"count":1,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4005\/revisions"}],"predecessor-version":[{"id":4006,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/posts\/4005\/revisions\/4006"}],"wp:attachment":[{"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/media?parent=4005"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/categories?post=4005"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/badgameshow.com\/steven\/wp-json\/wp\/v2\/tags?post=4005"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}