{"rsdb":{"rid":"152269","subhead":"","postdate":"0","aid":"114581","fid":"55","uid":"1","topic":"1","content":"
\n

\u4e00\uff1amvc<\/a><\/h1> \n

mvc\u7ed3\u6784\uff1a<\/h2> \n

\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\"
\u89c6\u56fe\uff08View\uff09\uff1a\u7528\u6237\u754c\u9762\u3002
\u63a7\u5236\u5668\uff08Controller\uff09\uff1a\u4e1a\u52a1\u903b\u8f91
\u6a21\u578b\uff08Model\uff09\uff1a\u6570\u636e\u4fdd\u5b58<\/p> \n

mvc\u5404\u90e8\u5206\u7684\u901a\u4fe1\u65b9\u5f0f<\/h2> \n

\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\"<\/p> \n

mvc\u4e92\u52a8\u6a21\u5f0f<\/h2> \n

\u901a\u8fc7 View \u63a5\u53d7\u6307\u4ee4\uff0c\u4f20\u9012\u7ed9 Controller\u3002
\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\"
\u53e6\u4e00\u79cd\u662f\u76f4\u63a5\u901a\u8fc7controller\u63a5\u53d7\u6307\u4ee4\u3002
\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\"<\/p> \n

mvc\u7684\u5386\u53f2<\/h2> \n
\r\nMVC \u7684\u6982\u5ff5\u6700\u65e9\u51fa\u73b0\u5728\u4e8c\u5341\u4e16\u7eaa\u516b\u5341\u5e74\u4ee3\u7684 \u65bd\u4e50\u5e15\u514b \u5b9e\u9a8c\u5ba4\u4e2d\uff08\u5bf9\uff0c\u5c31\u662f\u90a3\u4e2a\u53d1\u660e\u56fe\u5f62\u7528\u6237\u754c\u9762\u548c\u9f20\u6807\u7684\u5b9e\u9a8c\u5ba4\uff09\uff0c\u5f53\u65f6\u65bd\u4e50\u5e15\u514b\u4e3a Smalltalk \u53d1\u660e\u4e86\u8fd9\u79cd\u8f6f\u4ef6\u8bbe\u8ba1\u6a21\u5f0f\u3002<\/code><\/pre> \n 

controller\u5c42\u7684\u81c3\u80bf\u95ee\u9898<\/h2> \n

\u4e8e View \u6765\u8bf4\uff0c\u4f60\u5982\u679c\u62bd\u8c61\u5f97\u597d\uff0c\u90a3\u4e48\u4e00\u4e2a App \u7684\u52a8\u753b\u6548\u679c\u53ef\u4ee5\u5f88\u65b9\u4fbf\u5730\u79fb\u690d\u5230\u522b\u7684 App \u4e0a\u3002
\u5bf9\u4e8e Model \u6765\u8bf4\uff0c\u5b83\u5176\u5b9e\u662f\u7528\u6765\u5b58\u50a8\u4e1a\u52a1\u7684\u6570\u636e\u7684\uff0c\u5982\u679c\u505a\u5f97\u597d\uff0c\u5b83\u4e5f\u53ef\u4ee5\u65b9\u4fbf\u5730\u590d\u7528\u3002
\u5982\u679c\u6211\u4eec\u80fd\u591f\u610f\u8bc6\u5230 Controller \u91cc\u9762\u7684\u4ee3\u7801\u4e0d\u4fbf\u4e8e\u590d\u7528\uff0c\u6211\u4eec\u5c31\u80fd\u77e5\u9053\u4ec0\u4e48\u4ee3\u7801\u5e94\u8be5\u5199\u5728 Controller \u91cc\u9762\u4e86\uff0c\u90a3\u5c31\u662f\u90a3\u4e9b\u4e0d\u80fd\u590d\u7528\u7684\u4ee3\u7801\u3002<\/p> \n

\u4e00\u4e2a\u89e3\u51b3\u7684\u601d\u8def<\/h2> \n

Controller \u91cc\u9762\u5c31\u53ea\u5e94\u8be5\u5b58\u653e\u8fd9\u4e9b\u4e0d\u80fd\u590d\u7528\u7684\u4ee3\u7801\uff0c\u8fd9\u4e9b\u4ee3\u7801<\/p> \n

\r\n\u5728\u521d\u59cb\u5316\u65f6\uff0c\u6784\u9020\u76f8\u5e94\u7684 View \u548c Model\u3002\r\n\u76d1\u542c Model \u5c42\u7684\u4e8b\u4ef6\uff0c\u5c06 Model \u5c42\u7684\u6570\u636e\u4f20\u9012\u5230 View \u5c42\u3002\r\n\u76d1\u542c View \u5c42\u7684\u4e8b\u4ef6\uff0c\u5e76\u4e14\u5c06 View \u5c42\u7684\u4e8b\u4ef6\u8f6c\u53d1\u5230 Model \u5c42\u3002<\/code><\/pre> \n 

Controller \u53ea\u6709\u4ee5\u4e0a\u7684\u8fd9\u4e9b\u4ee3\u7801\uff0c\u90a3\u4e48\u5b83\u7684\u903b\u8f91\u5c06\u975e\u5e38\u7b80\u5355\uff0c\u800c\u4e14\u4e5f\u4f1a\u975e\u5e38\u77ed\u3002<\/p> \n

controller\u8fdb\u4e00\u6b65\u7684\u89e3\u51b3\u65b9\u6848<\/h2> \n

\u4f46\u662f\uff0c\u6211\u4eec\u5374\u5f88\u96be\u505a\u5230\u8fd9\u4e00\u70b9\uff0c\u56e0\u4e3a\u8fd8\u662f\u6709\u5f88\u591a\u903b\u8f91\u6211\u4eec\u4e0d\u77e5\u9053\u5199\u5728\u54ea\u91cc\uff0c\u4e8e\u662f\u5c31\u90fd\u5199\u5230\u4e86 Controller \u4e2d\u4e86\uff0c\u90a3\u6211\u4eec\u63a5\u4e0b\u6765\u5c31\u770b\u770b\u5176\u5b83\u903b\u8f91\u5e94\u8be5\u5199\u5728\u54ea\u91cc\u3002<\/p> \n

\r\n\u5c06 UITableView \u7684 Data Source \u5206\u79bb\u5230\u53e6\u5916\u4e00\u4e2a\u7c7b\u4e2d\u3002\r\n\u5c06\u6570\u636e\u83b7\u53d6\u548c\u8f6c\u6362\u7684\u903b\u8f91\u5206\u522b\u5230\u53e6\u5916\u4e00\u4e2a\u7c7b\u4e2d\u3002\r\n\u5c06\u62fc\u88c5\u63a7\u4ef6\u7684\u903b\u8f91\uff0c\u5206\u79bb\u5230\u53e6\u5916\u4e00\u4e2a\u7c7b\u4e2d\u3002<\/code><\/pre> \n 

\u5177\u4f53\u5305\u62ec\u4e00\u4e0b\u51e0\u79cd\u89e3\u51b3\u65b9\u6848\uff1a<\/h2> \u5c06\u7f51\u7edc\u8bf7\u6c42\u62bd\u8c61\u5230\u5355\u72ec\u7684\u7c7b\u4e2d \u5c06\u754c\u9762\u7684\u62fc\u88c5\u62bd\u8c61\u5230\u4e13\u95e8\u7684\u7c7b\u4e2d \n

\u6784\u9020 ViewModel
\u8fd9\u6837\u62bd\u8c61\u4e4b\u540e\uff0cView \u53ea\u63a5\u53d7 ViewModel\uff0c\u800c Controller \u53ea\u9700\u8981\u4f20\u9012 ViewModel \u8fd9\u4e48\u4e00\u884c\u4ee3\u7801\u3002\u800c\u53e6\u5916\u6784\u9020 ViewModel \u7684\u8fc7\u7a0b\uff0c\u6211\u4eec\u5c31\u53ef\u4ee5\u79fb\u52a8\u5230\u53e6\u5916\u7684\u7c7b\u4e2d\u4e86\u3002<\/p> \n

\u4e13\u95e8\u6784\u9020\u5b58\u50a8\u7c7b<\/p> \n

\u4e8c\uff1aMVP<\/h1> \n

MVP \u6a21\u5f0f\u5c06 Controller \u6539\u540d\u4e3a Presenter\uff0c\u540c\u65f6\u6539\u53d8\u4e86\u901a\u4fe1\u65b9\u5411\u3002
\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\"
1. \u5404\u90e8\u5206\u4e4b\u95f4\u7684\u901a\u4fe1\uff0c\u90fd\u662f\u53cc\u5411\u7684\u3002
2. View \u4e0e Model \u4e0d\u53d1\u751f\u8054\u7cfb\uff0c\u90fd\u901a\u8fc7 Presenter \u4f20\u9012\u3002
3. View \u975e\u5e38\u8584\uff0c\u4e0d\u90e8\u7f72\u4efb\u4f55\u4e1a\u52a1\u903b\u8f91\uff0c\u79f0\u4e3a\u201d\u88ab\u52a8\u89c6\u56fe\u201d\uff08Passive View\uff09\uff0c\u5373\u6ca1\u6709\u4efb\u4f55\u4e3b\u52a8\u6027\uff0c\u800c Presenter\u975e\u5e38\u539a\uff0c\u6240\u6709\u903b\u8f91\u90fd\u90e8\u7f72\u5728\u90a3\u91cc\u3002<\/p> \n

\u4e09\uff1aMVVM<\/h1> \n

MVVM \u6a21\u5f0f\u5c06 Presenter \u6539\u540d\u4e3a ViewModel\uff0c\u57fa\u672c\u4e0a\u4e0e MVP \u6a21\u5f0f\u5b8c\u5168\u4e00\u81f4\u3002
\"\u8fd9\u91cc\u5199\u56fe\u7247\u63cf\u8ff0\"<\/p> \n

MVVM\u7684\u5386\u53f2<\/h2> \n

\u76f8\u5bf9\u4e8e MVC \u7684\u5386\u53f2\u6765\u8bf4\uff0cMVVM \u662f\u4e00\u4e2a\u76f8\u5f53\u65b0\u7684\u67b6\u6784\uff0cMVVM \u6700\u65e9\u4e8e 2005 \u5e74\u88ab\u5fae\u8f6f\u7684 WP<\/a>F \u548c Silverlight \u7684\u67b6\u6784\u5e08 John Gossman \u63d0\u51fa\uff0c\u5e76\u4e14\u5e94\u7528\u5728\u5fae\u8f6f\u7684\u8f6f\u4ef6\u5f00\u53d1\u4e2d\u3002\u5f53\u65f6 MVC \u5df2\u7ecf\u88ab\u63d0\u51fa\u4e86 20 \u591a\u5e74\u4e86\uff0c\u53ef\u89c1\u4e24\u8005\u51fa\u73b0\u7684\u5e74\u4ee3\u5dee\u522b\u6709\u591a\u5927\u3002<\/p> \n

MVVM\u7684\u95ee\u9898<\/h2> \n

MVVM \u7684\u4f5c\u8005 John Gossman \u7684 \u6279\u8bc4 \u5e94\u8be5\u662f\u6700\u4e3a\u4e2d\u80af\u7684\u3002John Gossman \u5bf9 MVVM \u7684\u6279\u8bc4\u4e3b\u8981\u6709\u4e24\u70b9\uff1a
\u7b2c\u4e00\u70b9\uff1a\u6570\u636e\u7ed1\u5b9a\u4f7f\u5f97 Bug \u5f88\u96be\u88ab\u8c03\u8bd5\u3002\u4f60\u770b\u5230\u754c\u9762\u5f02\u5e38\u4e86\uff0c\u6709\u53ef\u80fd\u662f\u4f60 View \u7684\u4ee3\u7801\u6709 Bug\uff0c\u4e5f\u53ef\u80fd\u662f Model \u7684\u4ee3\u7801\u6709\u95ee\u9898\u3002\u6570\u636e\u7ed1\u5b9a\u4f7f\u5f97\u4e00\u4e2a\u4f4d\u7f6e\u7684 Bug \u88ab\u5feb\u901f\u4f20\u9012\u5230\u522b\u7684\u4f4d\u7f6e\uff0c\u8981\u5b9a\u4f4d\u539f\u59cb\u51fa\u95ee\u9898\u7684\u5730\u65b9\u5c31\u53d8\u5f97\u4e0d\u90a3\u4e48\u5bb9\u6613\u4e86\u3002
\u7b2c\u4e8c\u70b9\uff1a\u5bf9\u4e8e\u8fc7\u5927\u7684\u9879\u76ee\uff0c\u6570\u636e\u7ed1\u5b9a\u9700\u8981\u82b1\u8d39\u66f4\u591a\u7684\u5185\u5b58\u3002<\/p> \n<\/dd>","orderid":"0","title":"\u9762\u8bd5\u4e4b\u8def\uff083\uff09-\u8be6\u89e3MVC\uff0cMVP\uff0cMVVM","smalltitle":"","mid":"0","fname":"windows\u7f16\u7a0b\u57fa\u7840","special_id":"0","bak_id":"0","info":"0","hits":"541","pages":"1","comments":"0","posttime":"2016-04-23 17:39:08","list":"1461404348","username":"admin","author":"","copyfrom":"","copyfromurl":"","titlecolor":"","fonttype":"0","titleicon":"0","picurl":"http:\/\/www.cppentry.com\/upload_files\/article\/55\/1_ktlfu__.png","ispic":"1","yz":"1","yzer":"","yztime":"0","levels":"0","levelstime":"0","keywords":"
\u9762\u8bd5<\/A> \u8be6\u89e3<\/A> MVC<\/A> MVP<\/A> MVVM<\/A>","jumpurl":"","iframeurl":"","style":"","template":"a:3:{s:4:\"head\";s:0:\"\";s:4:\"foot\";s:0:\"\";s:8:\"bencandy\";s:0:\"\";}","target":"0","ip":"14.17.22.31","lastfid":"0","money":"0","buyuser":"","passwd":"","allowdown":"","allowview":"","editer":"","edittime":"0","begintime":"0","endtime":"0","description":"\u9762\u8bd5\u4e4b\u8def\uff083\uff09-\u8be6\u89e3MVC\uff0cMVP\uff0cMVVM","lastview":"1487706176","digg_num":"0","digg_time":"0","forbidcomment":"0","ifvote":"0","heart":"","htmlname":"","city_id":"0"},"page":"1"}