iPhone SDK:UIScrollView不滚动

Chr*_*h v 9 iphone objective-c uiscrollview uiimageview

我只是无法让我的滚动视图实际滚动..一切都显示正常,除了它只是不会滚动.....这是我的代码:

- (void)viewDidLoad {
    [super viewDidLoad];

    UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 600)];
    scrollView.contentSize = CGSizeMake(320, 600);
    scrollView.scrollEnabled = YES;
    scrollView.clipsToBounds = YES;
    [self.view addSubview:scrollView];

    planView = [[WorkoutPlanView alloc] initWithImage:[UIImage imageNamed:@"WorkoutTable.png"]];
    planView2 = [[WorkoutPlanView alloc] initWithImage:[UIImage imageNamed:@"WorkoutTable.png"]];
    planView2.frame = CGRectMake(0, 164, 320, 165);
    planView3 = [[WorkoutPlanView alloc] initWithImage:[UIImage imageNamed:@"WorkoutTable.png"]];
    planView3.frame = CGRectMake(0, 328, 320, 165);
    planView4 = [[WorkoutPlanView alloc] initWithImage:[UIImage imageNamed:@"WorkoutTable.png"]];
    planView4.frame = CGRectMake(0, 505, 320, 165);
    [scrollView addSubview:planView];
    [scrollView addSubview:planView2];
    [scrollView addSubview:planView3];
    [scrollView addSubview:planView4];
}
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

pop*_*850 20

contentSize必须比滚动型对有框大到什么可滚动.:)

在这种情况下,他们都(320, 600)将你的scrollView的init更改为

UIScrollView *scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 480)];
Run Code Online (Sandbox Code Playgroud)