如何检测“快速触摸”在 UITableView 上用于切换全屏或从全屏切换?

发布于 2024-10-26 01:07:15 字数 203 浏览 2 评论 0原文

用于检测 UITableView 上的“快速触摸”以切换到全屏/从全屏切换的编码是什么?

特别是,这是因为用户位于 UITableView 上,他们仍然需要能够向上/向下拖动项目列表,并可能单击单元格/行以进行更深入的挖掘。但如果他们触摸得很快,那么这可能会触发全屏模式(即导航栏和工具栏)之间的切换。

背景 - 当我说切换到全屏或从全屏切换时,我指的是执行

What is the coding to detect a "quick touch" on a UITableView for the purpose of toggling to/from full screen?

In particular this is because the user is on a UITableView they would still need the ability to drag the list of items up/down, and potentially click on a cell/row to dig deeper. But if they touched quickly then this could be the trigger to toggle between full-screen mode (i.e. nav bar & tool bar).

Background - When I say toggling to/from full screen I'm refering to carrying out what is described here, however in this answer there was no mention in terms of how to plug this into the callbacks for a UITableView which is being displayed within a UINavigationController stack.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

紫轩蝶泪 2024-11-02 01:07:15

下面的代码可能对你有帮助

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
{
    timeStampStart = event.timestamp;
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    timeStampEnd = event.timestamp;
    touchDuration = timeStampEnd - timeStampStart;

    if(touchDuration > smallTimeStamp)
        [super touchesEnded:touches withEvent:event];
    else
        [self zoomMyTableView];
}

The following code might help you

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
{
    timeStampStart = event.timestamp;
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
    timeStampEnd = event.timestamp;
    touchDuration = timeStampEnd - timeStampStart;

    if(touchDuration > smallTimeStamp)
        [super touchesEnded:touches withEvent:event];
    else
        [self zoomMyTableView];
}
月亮是我掰弯的 2024-11-02 01:07:15

想要将此作为一个可能的答案,答案是没有相对直接的方法来实现我所要求的目标。这是在 UITableView 页面中检测点击或双击的一种方法,该页面已经检测到行触摸并向上/向下滚动等。

尚未验证是否是这种情况,但人们可以向上-如果他们认为这是真的,请投票这个答案。 (也在等待 ypk 的样本,他可能有答案)

Wanted to put up this as a possible answer, the answer being there is no relative straight way to achieve what I've asked for this. That is a way for a tap or double-tap to be detected in a UITableView page, which is already picking up row touches and scroll up/down etc.

Haven't verified whether this is the case or not, but people could up-vote this answer if they believe this to be true. (also waiting on sample from ypk who perhaps has an answer)

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文