YYText icon indicating copy to clipboard operation
YYText copied to clipboard

是否有办法处理yytextview的selectable上下选择与scrollview滑动的冲突?

Open seedotlee opened this issue 8 years ago • 7 comments

页面布局是这样的:

外层是一个scrollview(tableview),添加一个 YYTextView到scrollview中,YYTextView设置editable = false,selectable = true

这个时候如果选中文本的同时上下移动,会与外层的scrollview冲突。

seedotlee avatar Jun 27 '16 11:06 seedotlee

具体是什么冲突呢?

ibireme avatar Jun 28 '16 15:06 ibireme

上下选择文本的时候,外层scrollview会滑动,还有一个bug就是,外层滑动后,选择文本的指针图像会停留在当前window再也不消失了

seedotlee avatar Jun 29 '16 01:06 seedotlee

试试设置外层 scrollView 的 delaysContentTouches、canCancelContentTouches 看看。

指针点是需要放到 window 上避免被遮挡,但是如果 textView 不知道它在 window 中位置发生变化,那就难以去触发更新了,这个暂时没想到什么太好的办法,如果一定要处理的话,可以试试在滑动时调用 [[YYTextEffectWindow sharedWindow] showSelectionDot:[textView valueForKey:@"_selectionView"]];

ibireme avatar Jun 29 '16 14:06 ibireme

通过修改YYTextView,将_updateMagnifier的tracking状态通过delegate将状态返回出来,在使用的过程中判断tracking状态来控制外层scrolview 的scrollEnabled,可以达到避免冲突的效果。

不知道这个思路你愿不愿意添加进去。

不过我觉得这个应该还是挺有用的,如微博的详情页面使用YYTextView就会冲突的嘛。

seedotlee avatar Jun 30 '16 04:06 seedotlee

@seedotlee 我也有同样的问题, 你具体是怎么修改的, 方便列下代码吗? 谢啦

shanbozhu avatar Sep 27 '17 09:09 shanbozhu

I have got same problem

adrian09h avatar Oct 30 '20 19:10 adrian09h

#953 will fix it

wolfcon avatar Apr 26 '21 10:04 wolfcon