Copy and paste text with buttons

后端 未结 1 464
不知归路
不知归路 2021-01-15 01:05

I want to know what code I have to write under and IB action button so that when i click the button that is called copy, it will copy the text in a specified text view, and

相关标签:
1条回答
  • 2021-01-15 01:23

    Look into UIPasteboard Class Reference.

    Set

    -(IBAction)copyText
    {
        [[UIPasteboard generalPasteboard] setString:myTextView.text];
    }
    

    Get

    myTextView2.text = [[UIPasteboard generalPasteboard] string];
    
    0 讨论(0)
提交回复
热议问题