私はUIButton
上に持ってUIImageView
いUIScrollView
ます。ただし、ボタンが機能しません(ボタンが反応せず、書き込みましたbutton.userInteractionEnabled = YES
)。なんで?
pagingView = [[InfinitePagingView alloc] initWithFrame:CGRectMake(0.f, 0.f, self.view.frame.size.width, self.view.frame.size.height - naviBarHeight)];
pagingView.delegate = self;
[self.view addSubview:pagingView];
UIImage *image1 = [UIImage imageNamed:[NSString stringWithFormat:@"1.jpg"]];
page1 = [[UIImageView alloc] initWithImage:image1];
page1.frame = CGRectMake(0, 0, pagingView.frame.size.width * 0.8, pagingView.frame.size.height * 0.8);
page1.userInteractionEnabled = YES;
page1.contentMode = UIViewContentModeScaleAspectFit;
btn = [UIButton buttonWithType:UIButtonTypeRoundedRect];
btn.frame = CGRectMake(100, 200, 50, 50);
[btn addTarget:self action:@selector(toControl) forControlEvents:UIControlEventTouchUpInside];
[page1 addSubview:btn];
[pagingView addPageView:page1];