2010-05-02 101 views
1

我有割問題從的UITextView一些文字,我。我不知道如何可以實現剪切,例如複製或粘貼是這樣的:UITextView切割問題! (iPhone SDK)

-(IBAction)copy { 

     NSString *copyString = [[NSString alloc] initWithFormat:@"%@",[textPad text]]; 
     UIPasteboard *pb = [UIPasteboard generalPasteboard]; 
     [pb setString:copyString]; 

    } 

    -(IBAction)paste { 
     UIPasteboard *pb = [UIPasteboard generalPasteboard]; 
     textPad.text = [pb string]; 
    } 

而是斬!謝謝你,

+0

任何答案嗎? :-S – 2010-05-02 19:33:49

回答

2

你可以做到這一點,因爲切只是一個拷貝和刪除:

-(IBAction)cut { 
    [self copy]; 
    textPad.text = @""; 
} 
+0

WOOW好主意!謝謝 – 2010-05-22 10:57:22