iPhone中如何copy,cut,paste

长平狐 发布于 2012/08/13 15:44
阅读 51
收藏 0

-(IBAction)cut {
  [self copy];
  textPad.text = @"";
} 
 
-(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];
} 
 

 

代码一目了然,很简单吧。


原文链接:http://blog.csdn.net/favormm/article/details/6573349
加载中
返回顶部
顶部