CoderMikeHe / MHDevelopExample_Objective_C

🔥🔥🔥 iOS开发技术要点汇总,核心功能配备文档。表情键盘布局、大文件分片上传、基于MVC的基类设计、MVVM+RAC实践、微信朋友圈实现方案等。
MIT License
1.05k stars 179 forks source link

全文展开 #1

Open MysteryRan opened 7 years ago

MysteryRan commented 7 years ago

你这个设计思路,如果用区头来当做朋友圈的正文,点击展开全文该怎么实现。

CoderMikeHe commented 7 years ago

点击展开全文功能,无非就是控制区头的高度即可。每个字体的对应的行高我们是知道,点击全文这个状态改变,我们就改变区头的高度即可。

MysteryRan commented 7 years ago

我之前是在区头里按钮的点击事件中通过代理更新区头的高度 好像会出现问题 不知道是不是我的写法有问题

CoderMikeHe commented 7 years ago

嗯嗯 ,多检查一下。尺寸是计算错的话是不会有错的。建议你用自动布局,试试看

MysteryRan commented 7 years ago

好的 谢谢你

hugaveme commented 6 years ago

大神你好 看了你的Demo 不明白MVVM+RAC 的cell的viewModel 怎么和controller的ViewModel 怎么进行信号交互,就是cell的VM 等信号 是怎么通过controller的VM接收到信号的

CoderMikeHe commented 6 years ago

这个其实特别简单吧。你点击展开全文,重新计算区头的高度,然后你只需要刷新对应区头即可呀,然后会去走设置区头高度的代理方法。反之,收起也类似。

CoderMikeHe commented 6 years ago

一般cell绑定ViewModel是 ItemViewModel,当然ItemViewModel的创建是在控制器的的ViewModel中,这个时候你当然可以将控制器的的ViewModel中创建的信号辅助个itemViewModel的属性上呀,到时候cell上的的事件传递执行itemViewModel的信号,间接第使用了控制器的的ViewModel中创建的信号。这样不就传递起来了吗?

hugaveme commented 6 years ago

这个时候你当然可以将控制器的的ViewModel中创建的信号辅助个itemViewModel的属性上呀 大神 这个辅助属性是什么操作

CoderMikeHe commented 6 years ago

好吧,建议你看看SUGoodsViewModel2.m 里面的这段代码: /// 转化数据 NSArray viewModels = [goodsData.data.rac_sequence map:^SUGoodsItemViewModel (SUGoods goods) { @strongify(self); SUGoodsItemViewModel itemViewModel = [[SUGoodsItemViewModel alloc] initWithGoods:goods]; itemViewModel.didClickedLocationSubject = self.didClickedLocationSubject; itemViewModel.didClickedAvatarSubject = self.didClickedAvatarSubject; itemViewModel.didClickedReplySubject = self.didClickedReplySubject; itemViewModel.operationCommand = self.operationCommand; return itemViewModel; }].array; 这里就是赋值操作呀。

hugaveme commented 6 years ago

哦 明白了是赋值 我看你上面说的辅助 谢谢大神

CoderMikeHe commented 6 years ago

哈哈 sorry,用词不当哈。