我不知道我做了什么,但我正在实现UIViewController Containment,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代码是相同的,我唯一的#import是UIKit。
换句话说,我的应用程序中从UIScrollView继承的所有类突然表现得就像它们的scrollEnabled属性设置为NO一样,我无法改变它。
答案 0 :(得分:0)
可能是"滚动启用"接口构建器中的scrollview上的属性。
答案 1 :(得分:0)
// 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];
答案 2 :(得分:0)
您可以像这样创建。
scrollView=[[UIScrollView alloc]init]WithFrame:CGRectMake(0,0 ,320,480)];
[scrollView setScrollEnabled:YES];
[scrollView setContentSize:CGSizeMake(320, 600)];
scrollView.backgroundColor = [UIColor clearColor];
答案 3 :(得分:0)
AFAIK这是由糟糕的第三方代码引起的,该代码使用UIPanGestureRecognizers
而没有实现gestureRecognizerShouldBegin:
,从而覆盖了正常的滚动行为。