I have a problem with my code
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];
This is the code for the pagination through scrollview with tableview,but i need to put data in these 5 tableview cells that i create above.How to put data through these tableviews.(Data from xml parsing)
Thanks advance
You’ve correctly set
selfas the tableView’s data source and delegate.The table views will now ask for the data and you need to implement the
UITableViewDataSourceprotocol.Each of those methods will get a reference to the table view that’s asking for information, so you can use that to figure out which data to provide (for which of your 5 table views).
You may want to have a look at the Table View Programming Guide.