右にスクロールしないスクロール ビューがあります。以下のコードを簡略化しました。ビューと、実際のコードに追加するいくつかの水平ボタンを描画します。ボタン間の空白をドラッグすると、ビューがスクロールします。ボタンに指を置いても、スクロールしません。関連する提案の後、delaysContentTouches = YES 行を追加しようとしましたが、違いはないようです。 UIButtonsを使用したUIScrollview - スプリングボードを再作成する方法は?
私は何を間違っていますか?ティア、ロブ
コードを更新しました
- (void)viewDidLoad {
l = [self landscapeView];
[self.view addSubview:l];
[l release];
}
- (UIScrollView *) landscapeView {
// LANDSCAPE VIEW
UIScrollView *landscapeView = [[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 325)];
landscapeView.backgroundColor = [UIColor whiteColor];
landscapeView.delaysContentTouches = YES;
NSInteger iMargin, runningY, n;
iMargin = 3;
runningY = iMargin;
for (n = 1; n <= 38; n++) {
//add day labels
UIButton *templabel = [[UIButton alloc] initWithFrame:CGRectMake(iMargin,runningY,320 - ( 2 * iMargin),20)];
templabel.backgroundColor = [UIColor grayColor];
[landscapeView addSubview:templabel];
[templabel release];
runningY = runningY + 30;
}
landscapeView.contentSize = CGSizeMake( 320, runningY);
return landscapeView;
}