长按复制

时间:2025-05-15 07:35:23
- (void)awakeFromNib { [super awakeFromNib]; UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(problemToCopy:)]; = 1; [self addGestureRecognizer:longPress]; // Initialization code } - (void)problemToCopy:(UILongPressGestureRecognizer *)gesture { if ( == UIGestureRecognizerStateBegan){ QHPiMomentsCopyTextViewController *copy = [[QHPiMomentsCopyTextViewController alloc] initWithNibName:@"QHPiMomentsCopyTextViewController" bundle:nil]; = ; if (isIOS8) { = UIModalPresentationOverCurrentContext; [[self obtainShowVC] presentViewController:copy animated:NO completion:^{ }]; }else { [UIApplication sharedApplication]. = UIModalPresentationCurrentContext; [[self obtainShowVC] presentViewController:copy animated:NO completion:nil]; } } } - (UIViewController *)obtainShowVC { UITabBarController *tabCtrl = (UITabBarController *)[UIApplication sharedApplication].; UINavigationController *navi = ; UIViewController *vc = [navi visibleViewController]; return vc; }