码迷,mamicode.com
首页 > 其他好文 > 详细

复制文字,链接,剪贴板的使用

时间:2016-01-03 17:13:15      阅读:161      评论:0      收藏:0      [点我收藏+]

标签:

//获取剪贴板

        UIPasteboard *pasteboard = [UIPasteboard generalPasteboard];

        //设置剪贴板内容

        pasteboard.string = [defaults objectForKey:@"shareURL"];

        if (pasteboard.string) {

            _alertView = [[AlertView alloc] initWithFrame:CGRectMake((UIScreen_width-(UIScreen_width/320)*150)/2, (UIScreen_width/320)*220, (UIScreen_width/320)*150, (UIScreen_width/320)*30)];

            [_alertView createAlertViewWithTitle:@"已复制到粘贴板" delayInSeconds:2 completion:^{

                [_alertView removeFromSuperview];

            }];

            [self.view addSubview:_alertView];

        } else {

            _alertView = [[AlertView alloc] initWithFrame:CGRectMake((UIScreen_width-(UIScreen_width/320)*150)/2, (UIScreen_width/320)*220, (UIScreen_width/320)*150, (UIScreen_width/320)*30)];

            [_alertView createAlertViewWithTitle:@"复制失败" delayInSeconds:2 completion:^{

                [_alertView removeFromSuperview];

            }];

            [self.view addSubview:_alertView];

        }

复制文字,链接,剪贴板的使用

标签:

原文地址:http://www.cnblogs.com/OIMM/p/5096560.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!