Objective c 我的应用程序中的所有UIScrollView子体都已停止响应滚动

Objective c 我的应用程序中的所有UIScrollView子体都已停止响应滚动,objective-c,ios,xcode,uitableview,uikit,Objective C,Ios,Xcode,Uitableview,Uikit,我不知道我做了什么,但我正在实现UIViewController包容,突然UIKit UIScrollView子类停止响应滚动,即使我绕过了所有自定义应用程序代码。例如,此标准设置代码 self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; UIViewController *vc = [[UIViewController alloc] init]; vc.view = [[UIView al

我不知道我做了什么,但我正在实现UIViewController包容,突然UIKit UIScrollView子类停止响应滚动,即使我绕过了所有自定义应用程序代码。例如,此标准设置代码

self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];

UIViewController *vc = [[UIViewController alloc] init];
vc.view = [[UIView alloc] initWithFrame:self.window.frame];

UIScrollView *sv = [[UIScrollView alloc] initWithFrame:vc.view.frame];
sv.contentSize = CGSizeMake(400, 3000);
[vc.view addSubview:sv];
在一个全新的Xcode项目中,scrollView会滚动,但在我现有的项目中,滚动没有效果,滚动条也不会出现。两个项目中的AppDelegate代码相同,我唯一的导入是UIKit

换句话说,我的应用程序中从UIScrollView继承的所有类的行为突然就好像它们的scrollEnabled属性被设置为NO一样,我无法更改这一点。

它可能是interface builder中scrollview上的“scrolling enabled”属性

  // define the area that is initially visible
  scrollViewCustom.frame = CGRectMake(0, 5, 354, 500);

  // then define how much a user can scroll it
  [scrollViewCustom setContentSize:CGSizeMake(354, 960)];
此外,清除滚动视图的背景色以显示文本

   scrollViewCustom.backgroundColor = [UIColor clearColor];

你可以这样简单地创建

scrollView=[[UIScrollView alloc]init]WithFrame:CGRectMake(0,0 ,320,480)];
[scrollView setScrollEnabled:YES];
[scrollView setContentSize:CGSizeMake(320, 600)];
scrollView.backgroundColor = [UIColor clearColor];

AFAIK这是由糟糕的第三方代码造成的,该代码使用了
UIPangestureRecognitors
,但未实现
gestureRecognitizer shouldBegin:
,从而覆盖了正常的滚动行为。

scrollEnabled默认为YES。这个问题影响到我的应用程序中从UIScrollView继承的每个类(所有UITableView、UITextView等)。你的scrollingView工作正常,你有什么问题?问题是我的应用程序中所有从UIScrollView继承的类(UITableView、UITextView)都突然停止了对滚动的响应。即使我已将scrollEnabled设置为YES,它们的行为都好像scrollEnabled为NO一样。tableView和textView是控件而不是类。当在tableView上滚动时,scrollView不会滚动,在textView上滚动scrollView不会滚动,在这些控件之外,您尝试滚动的控件只会滚动scrollView。此代码实际上与我在示例中介绍的代码相同。我对背景色没有问题,问题在于滚动。