我有滚动查看屏幕底部。当我点击按钮它加载滚动视图。但scrollview占用完整的父视图。我无法控制一些直接制作的视角。如果我使用scrollview,我无法处理其他按钮操作,并单击其他子视图的事件。滚动查看屏蔽父视图
代码:
scrollview=[[UIScrollView alloc]initWithFrame:CGRectMake(0,0,320,self.view.frame.size.height)];
scrollview.scrollEnabled=YES;
for (int i = 0; i<[self.array count]; i++) {
NSLog(@"index %d",i);
imgView1=[[UIButton alloc]initWithFrame:CGRectMake(20+(i*74), 500, 72, 72)];
[imgView1 setTag:i+1];
[imgView1 addTarget:self action:@selector(Clicked:) forControlEvents:UIControlEventTouchUpInside];
[imgView1 setImage:((Mysof *)[self.array objectAtIndex:i]).photo forState:UIControlStateNormal];
[scrollview addSubview:imgView1];
}
[scrollview setContentSize:CGSizeMake(CGRectGetMaxX(imgView1.frame),self.view.frame.size.height)];
[self.view addSubview:scrollview];
登录:
scroll is <UIScrollView: 0x1f03d550; frame = (0 0; 320 568); clipsToBounds = YES; gestureRecognizers = <NSArray: 0x1f037090>; layer = <CALayer: 0x1f036670>; contentOffset: {0, 0}>
我建议您在设置内容之前和之后打印滚动视图的框架。让我知道输出。大概我可以帮你解决这个问题 –
我不明白 – user2674668
为你的滚动视图记录框架 –