华为荣耀60怎么长按手机屏幕

华为荣耀60怎么长按手机屏幕,第1张

您好,要长按华为荣耀60的屏幕,首先您需要打开华为荣耀60的屏幕,然后您需要按住屏幕上的某一个图标或者文字,并保持按住状态,一般情况下,您需要按住2秒钟以上,您可以看到屏幕上出现一个新的菜单,这个菜单中包含了一些您可以进行 *** 作的选项,您可以根据自己的需要来进行选择,这样就可以完成长按华为荣耀60的屏幕了。

1.创建集合试图,这个就比较简单了.创建完集合试图,我们在集合试图上面添加长按的手势

UIGestureRecognizerDelegate 先遵从协议

longPressGr =

=

=

=

2.我们在longpressToDo里面添加方法-(

)longPressToDo:(UILongPressGestureRecognizer *

(gestureRecognizer.state !=

=

*indexPath =

(indexPath ==

UICollectionViewCell* cell =

这里我们为tableview添加长按手势

UILongPressGestureRecognizer *longPressGr = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(longPressAction:)]

longPressGr.minimumPressDuration = 0.5f

longPressGr.numberOfTouchesRequired = 1

[_tableView addGestureRecognizer:longPressGr]

[longPressGr release]

这时我们会发现每次按住tableView并且松开的时候, longPressAction: 这个方法会执行2次

- (void)longPressAction:(UILongPressGestureRecognizer *)longPress

{

if (longPress.state == UIGestureRecognizerStateBegan) {

CGPoint point = [longPress locationInView:_tableView]

NSIndexPath *indexPath = [_tableView indexPathForRowAtPoint:point]// 可以获取我们在哪个cell上长按

if (indexPath != nil) {

NSLog(@"%ld", indexPath.row)

}

}

}


欢迎分享,转载请注明来源:内存溢出

原文地址: https://outofmemory.cn/bake/7852482.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-10
下一篇 2023-04-10

发表评论

登录后才能评论

评论列表(0条)

保存