如何找出哪个其他UIScrollView干扰scrollsToTop? [英] How to find out which other UIScrollView interferes with scrollsToTop?

查看:147
本文介绍了如何找出哪个其他UIScrollView干扰scrollsToTop?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有几个视图控制器与一个或多个scrollview。虽然我已经在具有多个滚动视图的视图控制器中显式设置了 scrollsToTop 标志,但是当点击状态栏时,一些滚动视图拒绝向上滚动。

I have several view controllers with one or multiple scrollviews. Although I have explicitly set the scrollsToTop flags in view controllers with more than one scroll view, some scroll views refuse to scroll up when I tap the status bar.

在推动另一个视图控制器并弹出它之后,手势有时会在之前没有的视图中工作。

After pushing another view controller and popping it the gesture sometimes works in the view it previously hasn't.

这很混乱,我只是不知道什么问题是。如何有效地调试此问题?

It's very confusing and I just don't know what the problem is. How can this issue effectively be debugged? Is there a global (private) notification for the status bar tap so I could scroll the views manually?

推荐答案

我已经使用了代码像下面的调试这个场景,之前:

I have used code like the following to debug this scenario, before:

- (void)findMisbehavingScrollViews
{
    UIView *view = [[UIApplication sharedApplication] keyWindow];
    [self findMisbehavingScrollViewsIn:view];
}

- (void)findMisbehavingScrollViewsIn:(UIView *)view
{
    if ([view isKindOfClass:[UIScrollView class]])
    {
        NSLog(@"Found UIScrollView: %@", view);
        if ([(UIScrollView *)view scrollsToTop])
        {
            NSLog(@"scrollsToTop = YES!");
        }
    }
    for (UIView *subview in [view subviews])
    {
        [self findMisbehavingScrollViewsIn:subview];
    }
}

根据您找到的UIScrollView数量,

Depending on how many UIScrollViews you find, you can modify that code to help debug your particular situation.

一些想法:


  • 更改

  • 打印这些滚动视图的视图层次结构,以标识其所有的超级视图。

理想情况下,您应该只在窗口层次结构中找到一个具有scrollsToTop设置为YES的UIScrollView。

Ideally, you should only find a single UIScrollView in the window hierarchy that has scrollsToTop set to YES.

这篇关于如何找出哪个其他UIScrollView干扰scrollsToTop?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆