UIButton inside UIScrollView doesn't fire on tap. Please help resolve it.
// Add a button
UIButton *btn1 = [[UIButton buttonWithType:UIButtonTypeCustom] retain];
btn1.frame = CGRectMake(0, 0, 26, 18);
btn1.bounds = CGRectMake(0, 0, 30.0, 30.0);
[btn1 addTarget:self action:@selector(buttonClick1:)
forControlEvents:UIControlEventTouchUpInside];
[scrollView addSubview:btn1];
- (void)buttonClick1:(id)sender {
int dd = 4;
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…