Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

全文展开 #1

Open
MysteryRan opened this issue Jun 14, 2017 · 11 comments
Open

全文展开 #1

MysteryRan opened this issue Jun 14, 2017 · 11 comments

Comments

@MysteryRan
Copy link

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

@CoderMikeHe
Copy link
Owner

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

@MysteryRan
Copy link
Author

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

@CoderMikeHe
Copy link
Owner

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

@MysteryRan
Copy link
Author

好的 谢谢你

@hugaveme
Copy link

hugaveme commented Nov 2, 2017

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

@CoderMikeHe
Copy link
Owner

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

@CoderMikeHe
Copy link
Owner

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

@hugaveme
Copy link

hugaveme commented Nov 3, 2017

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

@CoderMikeHe
Copy link
Owner

好吧,建议你看看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
Copy link

hugaveme commented Nov 3, 2017

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

@CoderMikeHe
Copy link
Owner

哈哈 sorry,用词不当哈。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants