代码如下:
UIPasteboard *pab = [UIPasteboard generalPasteboard];
NSString *string = @"测试";
[pab setString:string];
if (pab == nil) {
[MBProgressHUD showError:@"复制失败" toView:self.view];
}else
{
[MBProgressHUD showMessage:@"已复制"];
}
项目演示 (提取码:2b64)