iOS-点击按钮实现复制功能

代码如下:  

 UIPasteboard *pab = [UIPasteboard generalPasteboard];

        
        NSString *string = @"test";
        
        [pab setString:string];
        

        if (pab == nil) 

        {

            [MBProgressHUD showError:@"复制失败"];   

        }

        else

        {
            [MBProgressHUD showSuccess:@"已复制"];
        } 

你可能感兴趣的:(ios,常用,复制功能)