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

是否可以考虑增加一个获取cellWidth和scrollView.contentOffset.x的delegate #41

Closed
hstdt opened this issue Oct 30, 2018 · 3 comments

Comments

@hstdt
Copy link
Contributor

hstdt commented Oct 30, 2018

目前我使用下面这种方式获取的cellWidth,感觉可以增加一个获取cellWidthcontentOffset的delegate。(我的应用场景是用CategoryView做表头,通过cellWidth绘制表格,然后和通过KVO获取的scrollView.contentOffset.x做表格和表头同步滚动的效果😓)。

JXCategoryBaseCellModel *model = self.categoryTitleView.dataSource[0];
CGFloat cellWidth = model.cellWidth;
@pujiaxin33
Copy link
Owner

  • 通过KVO获取scrollView.contentOffset.x不行吗?
  • 而且contentScrollView,本身就是你自己创建的,你可以实现它的scrollViewDidScroll方法啊
  • 然后cellWidth就是数据源的数据,怎么用delegate方法来实现呢?难道你想说的是类似于UITableView的dataSource代理方法?但是CategoryView没有必要用这个啊,代码是要集成在内部的。

@hstdt
Copy link
Contributor Author

hstdt commented Nov 5, 2018

@pujiaxin33

  1. 是可以拿到,但是我怕之后如果控件结构调整了,就可能会出问题。
  2. 这个没问题,可以自己实现。
  3. 这个我说的不对,应该是一个通过index获取cellWidth的方法更好些。

@pujiaxin33
Copy link
Owner

1、版本很稳定了,不会有结构调整了,除非大重构,显然可能性很小了。
3、数据源属性dataSource都暴露出来了,为什么还要通过index获取cellWidth呢?对于后去cellWidth是便利了,但是api却稍显多余。

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

2 participants