我有两个 UIScrollView,aScroll 和 bScroll。而bScroll 是aScroll 的子视图。我面临的问题是,我想拖动 bScroll 并且不影响 aScroll。有人可以在这里帮助我吗?谢谢。
- (void)viewDidLoad
{
[super viewDidLoad];
UIScrollView *aScroll = [[UIScrollView alloc] initWithFrame:CGRectMake(50, 50, 400, 400)];
aScroll.backgroundColor = [UIColor grayColor];
aScroll.contentSize = CGSizeMake(401, 401);
[self.view addSubview:aScroll];
[aScroll release];
UIScrollView *bScroll = [[UIScrollView alloc] initWithFrame:CGRectMake(75, 75, 150, 150)];
bScroll.backgroundColor = [UIColor lightGrayColor];
bScroll.contentSize = CGSizeMake(500, 500);
[aScroll addSubview:bScroll];
[bScroll release];
UILabel *bLabel = [[UILabel alloc] initWithFrame:CGRectMake(20, 20, 30, 30)];
bLabel.text = @"B";
[bScroll addSubview:bLabel];
[bLabel release];
UILabel *aLabel = [[UILabel alloc] initWithFrame:CGRectMake(100, 250, 100, 40)];
aLabel.text = @"A";
[aScroll addSubview:aLabel];
[aLabel release];
}