长按复制
长按复制
娜一片蓝色星海 发表于1年前
长按复制
  • 发表于 1年前
  • 阅读 6
  • 收藏 0
  • 点赞 0
  • 评论 0

【腾讯云】买域名送云解析+SSL证书+建站!>>>   

- (void)awakeFromNib {
    [super awakeFromNib];
    
    UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(problemToCopy:)];
    longPress.numberOfTouchesRequired = 1;
    [self addGestureRecognizer:longPress];
   
    // Initialization code
}

- (void)problemToCopy:(UILongPressGestureRecognizer *)gesture {
    if (gesture.state == UIGestureRecognizerStateBegan){
        QHPiMomentsCopyTextViewController *copy = [[QHPiMomentsCopyTextViewController alloc] initWithNibName:@"QHPiMomentsCopyTextViewController" bundle:nil];
        copy.textToCopy = self.myReplyLabel.text;
        
        if (isIOS8) {
            
            copy.modalPresentationStyle = UIModalPresentationOverCurrentContext;
            
            [[self obtainShowVC] presentViewController:copy animated:NO completion:^{
                
            }];
        }else
        {
            [UIApplication sharedApplication].keyWindow.rootViewController.modalPresentationStyle = UIModalPresentationCurrentContext;
            
            [[self obtainShowVC] presentViewController:copy animated:NO completion:nil];
            
        }
    }
}

- (UIViewController *)obtainShowVC
{
    
    UITabBarController *tabCtrl = (UITabBarController *)[UIApplication sharedApplication].keyWindow.rootViewController;
    UINavigationController *navi = tabCtrl.selectedViewController;
    UIViewController *vc = [navi visibleViewController];
    return vc;
    
}

 

标签: 复制
  • 打赏
  • 点赞
  • 收藏
  • 分享
共有 人打赏支持
粉丝 1
博文 92
码字总数 14919
×
娜一片蓝色星海
如果觉得我的文章对您有用,请随意打赏。您的支持将鼓励我继续创作!
* 金额(元)
¥1 ¥5 ¥10 ¥20 其他金额
打赏人
留言
* 支付类型
微信扫码支付
打赏金额:
已支付成功
打赏金额: