我是 iphone 开发新手。谁能告诉我如何在水平滚动视图中添加垂直滚动视图。我浏览了许多样本,但无法清楚地了解它。我希望我的视图可以在垂直和水平方向上滚动。任何帮助表示赞赏。
这是我的滚动代码:
编辑:这是我的滚动代码
self.firstScroll.pagingEnabled=YES;
self.firstScroll.clipsToBounds=YES;
int numberOfViews=3;
for(int i=0;i<numberOfViews;i++){
CGFloat xOrigin=self.view.frame.size.width*i;
UIView *awesomeView=[[UIView alloc] initWithFrame:CGRectMake(xOrigin, 0, self.view.frame.size.width, self.view.frame.size.height)];
awesomeView.backgroundColor=[UIColor colorWithRed:0.5/i green:0.5 blue:0.5 alpha:1];
[self.firstScroll addSubview:awesomeView];
}
self.firstScroll.contentSize=CGSizeMake(self.view.frame.size.width*numberOfViews, self.view.frame.size.height);
[self.view addSubview:firstScroll];
self.nextVerticalScroll.pagingEnabled=YES;
for(int i=0;i<numberOfViews ;i++){
CGFloat yOrigin=self.view.frame.size.height * i;
UIView *verticalView=[[UIView alloc]initWithFrame:CGRectMake(0, yOrigin, self.view.frame.size.width, self.view.frame.size.height)];
verticalView.backgroundColor=[UIColor colorWithRed:0.5/i green:0.5 blue:0.5 alpha:1];
[self.nextVerticalScroll addSubview:verticalView];
}
self.nextVerticalScroll.contentSize=CGSizeMake(self.view.frame.size.width, self.view.frame.size.height*numberOfViews);
[self.view addSubview:nextVerticalScroll];
谢谢,
拉吉