I want to create a scrollview with paging enabled,with 5 pages,but the problem is these page must hold tableview.how 开发者_如何学JAVAto do this.
Try this :
scroll=[[UIScrollView alloc] initWithFrame:CGRectMake(0, 0, 320, 460)];
scroll.backgroundColor=[UIColor clearColor];
scroll.pagingEnabled=YES;
scroll.contentSize = CGSizeMake(320*5, 460);
CGFloat x=0;
for(int i=1;i<6;i++)
{
UITableView *table = [[UITableView alloc]initWithFrame:CGRectMake(x+10, 10, 300, 440) style:UITableViewStyleGrouped];
table.delegate=self;
table.dataSource=self;
[scroll addSubview:table];
[table release];
x+=320;
}
[self.view addSubview:scroll];
scroll.showsHorizontalScrollIndicator=NO;
[scroll release];
精彩评论