Full text copy by long and text copy

Source: Internet
Author: User

Full text copy by long and text copy

Recently, I made a function to copy all the content by text. I found a method on the Internet, which is easy to use, but I encountered a problem in the process of using it.

In my project, the text control is not a UILabel, but a third-party framework OHAttributedLabel found on the Internet. I will not talk about anything else. I will mainly write about the problems I encountered here. in advance, I set a long-pressed label gesture, but I finally found that the corresponding selector method was not executed. finally, it is found that one of the override methods-(UIView *) hitTest :( CGPoint) point withEvent :( UIEvent *) event causes the selector method not to be executed, the reason for not executing the task is that the hitTest returns an nil, which affects the long-pressed gesture. The final solution is to rewrite the hitTest method and return a non-empty result. the following is a simple implementation of the replication function.

Final Effect

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.