我有一个使用pagecontrol的UIScrollView。我将代码中的表格添加到滚动视图中。 tableviews的每边应该有20px的填充。所以我做了以下。UITableview未正确放置在uiscrollview中
CGRect frame = self.scrollView.bounds;
frame.size.width = 280.0f;
frame.size.height = self.scrollView.bounds.size.height;
frame.origin.x = (320 * page)+20;
NSLog(@"orgin x is %d",(320 * page)+20);
NSLog(@"orgin x is %f",frame.origin.x);
frame.origin.y = 0;
UITableView *tableStage = [[UITableView alloc]initWithFrame:frame];
tableStage.backgroundColor = [UIColor colorWithRed:(250/255.0) green:(248/255.0) blue:(247/255.0) alpha:100];
tableStage.delegate = self;
tableStage.dataSource = self;
tableStage.tag = page;
tableStage.contentMode = UIViewContentModeScaleAspectFit;
[self.scrollView addSubview:tableStage];
[self.pageViews replaceObjectAtIndex:page withObject:tableStage];
但我得到以下结果。
就像你可以看到下一个tableview总是移动更多的东西到左边。任何想法如何我可以解决这个问题?
是什么[self.pageViews replaceObjectAtIndex:页withObject:tableStage]吗?用新表(tableStage)替换当前表? – Amar 2013-05-14 09:40:41