左侧列表控制右侧列表,如图所示:

首页在ViewController里面创建两个tableview,

把左侧tableview的代理方法单独出VC中抽离出来,VC中只实现右侧列表的代理方法
新建类LeftTableViewModel,在.h中做如下声明:

在.m中做如下实现:


在VC中关联左右两边的tableview:

初始化左侧列表:

这样在一个VC下控制两张表只用100行代码就能完成,不需用if eles 大法做大量的判断.
左侧列表控制右侧列表,如图所示:
首页在ViewController里面创建两个tableview,
把左侧tableview的代理方法单独出VC中抽离出来,VC中只实现右侧列表的代理方法
新建类LeftTableViewModel,在.h中做如下声明:
在.m中做如下实现:
在VC中关联左右两边的tableview:
初始化左侧列表:
这样在一个VC下控制两张表只用100行代码就能完成,不需用if eles 大法做大量的判断.
本文标题:筛选页面尝试MVVM双向绑定
本文链接:https://www.haomeiwen.com/subject/vqguhttx.html
网友评论