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

添加自定义视图,再输入文本会有视图重复问题 #6

Open
devtofu opened this issue Nov 23, 2018 · 9 comments
Open

添加自定义视图,再输入文本会有视图重复问题 #6

devtofu opened this issue Nov 23, 2018 · 9 comments

Comments

@devtofu
Copy link

devtofu commented Nov 23, 2018

用的是 attachment.view 添加的自定义 UIImageView

会有视图重复添加的 bug ,可以帮助我解决吗

8efc278776e0aea83540efc028e670ec

@12207480
Copy link
Owner

12207480 commented Nov 23, 2018

没看懂 能否提供demo

@devtofu
Copy link
Author

devtofu commented Nov 29, 2018

刚看到,等我弄个 demo 传上来

@devtofu
Copy link
Author

devtofu commented Dec 11, 2018

你在另一个 issues 修改了这个问题,但我测试,又出现另外一个问题,就是一次性添加多张大图的时候,永远也滚动不到底部

@devtofu
Copy link
Author

devtofu commented Dec 11, 2018

复现的步骤是插入完多张图片后保存这条复文本,然后再次编辑,主动调用 textView.becomeResponder()
光标定位不到最后一个字,这时去滚动,滚动不到底部

@12207480
Copy link
Owner

希望能提供一个复现的demo

@devtofu
Copy link
Author

devtofu commented Dec 18, 2018

暂时没办法弄 demo, 数据保存比较麻烦,

图片会重叠的问题,我试着加了一段代码

- (void)setContentSize:(CGSize)contentSize {
    if (!CGSizeEqualToSize(self.contentSize, contentSize)) {
        [self.textRender.textStorage enumerateAttribute:NSAttachmentAttributeName inRange:NSMakeRange(0, self.textRender.textStorage.length) options:0 usingBlock:^(id  _Nullable value, NSRange range, BOOL * _Nonnull stop) {
            if ([value isKindOfClass:[TYTextAttachment class]]) {
                [self.textRender.layoutManager invalidateDisplayForCharacterRange:range];
            }
        }];
    }
    [super setContentSize:contentSize];
}

应该是解决了。

@devtofu
Copy link
Author

devtofu commented Dec 18, 2018

iOS 10 系统上图片会重叠的概率非常大

@devtofu
Copy link
Author

devtofu commented Dec 24, 2018

@12207480 大佬,还是同样的问题,使用中还是容易出现附件重叠
怎么能联系到你 我的 demo 发给你,上传这里不方便, 不宜公开部分代码

@12207480
Copy link
Owner

加我 qq 122074809

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