1
我將子視圖添加到UIScrollView
。對於這個問題,我簡化了添加的視圖:testView
它包含一個UIButton
UIScrollView子視圖並非總是可點擊
我的滾動視圖是偉大的工作,但上的按鈕觸摸都不盡如人意。
-
只在(近似)100的第一像素
- 我可以點擊第一個按鈕,但。
- 滾動工作得很好。
- 我不能在第一個按鈕結束單擊
- 我不能點擊其他按鈕
這裏是我的代碼:
__block CGFloat scrollViewContentSize = 0;
__block CGFloat buttonRectOrigineY = 0;
[self.itemsToDisplay enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
CGRect frameTest = CGRectMake(0, buttonRectOrigineY/2, 320, 200);
UIButton *testButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
testButton.frame = frameTest;
UIView *testView = [[UIView alloc] initWithFrame:frameTest];
[testView addSubview:testButton];
[self.articleScrollView addSubview:testView];
buttonRectOrigineY += 200;
scrollViewContentSize += 200;
}];
[self.articleScrollView setContentSize:CGSizeMake(320, scrollViewContentSize)];
這裏是圖像很好地理解我的問題:
謝謝,我把一些'backgroundcolor'來理解我的意見和按鈕,以及在我的按鈕上的一些視圖。不管怎樣,謝謝你 – 2013-03-14 17:53:04