Comment faire pour désactiver le défilement vertical dans UIScrollView (Obj-C)

Je veux désactiver le défilement vertical de mon UIScrollView, si possible.. Mon code est comme ci-dessous.. fonctionne bien sauf les utilisateurs peuvent faire défiler en haut et en bas, ce qui ne devrait pas être là je crois.. Merci d'avance..

    UIScrollView *scroll = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 100, self.view.frame.size.width, self.view.frame.size.height / 3)];   
scroll.contentSize = CGSizeMake(scroll.contentSize.width,scroll.frame.size.height); 
scroll.pagingEnabled = YES;
scroll.backgroundColor = [UIColor blackColor];
int xVal = 30;
NSInteger numberOfViews = 5;
for (int i = 0; i < numberOfViews; i++) {
UILabel *testLabel1 = [[UILabel alloc] initWithFrame:CGRectMake(xVal, 0, 90, 100)];
UILabel *testLabel2 = [[UILabel alloc] initWithFrame:CGRectMake(xVal, 20, 90, 100)];
UILabel *testLabel3 = [[UILabel alloc] initWithFrame:CGRectMake(xVal, 40, 90, 100)];
testLabel2.backgroundColor = [UIColor clearColor];
testLabel2.text =@"Test1";
testLabel2.textColor = [UIColor whiteColor];
testLabel2.font = [UIFont boldSystemFontOfSize:12];
testLabel1.backgroundColor = [UIColor clearColor];
testLabel1.text =@"Test2";
testLabel1.textColor = [UIColor whiteColor];
testLabel1.font = [UIFont boldSystemFontOfSize:12];
testLabel3.backgroundColor = [UIColor clearColor];
testLabel3.text =@"Test3";
testLabel3.textColor = [UIColor whiteColor];
testLabel3.font = [UIFont boldSystemFontOfSize:12];
xVal += 120;
UIView *view = [[UIView alloc] initWithFrame:CGRectMake(xVal, 30, 150, 130)];
view.backgroundColor = [UIColor blackColor];
xVal += 200;
[scroll addSubview:testLabel1];
[scroll addSubview:testLabel2];
[scroll addSubview:testLabel3];
[scroll addSubview:view];
}
[self.view addSubview:scroll];
double possible de stackoverflow.com/questions/5095713/...
oui j'ai utilisé la même chose, mais ne fonctionne pas pour moi!!
Est-ce une application iPhone?
il est étiqueté ios.
J'ai pris ton code et de le placer dans le viewDidLoad dans un nouveau projet et je n'ai pas de défiler à tous... Essayez de définir le scrollView contentSize à la fin de cette méthode.

OriginalL'auteur user123 | 2012-08-07