在iphone中的单个viewcontroller中的一个UIScrollView中添加两个表

时间:2014-01-21 09:43:07

标签: ios iphone uitableview uiscrollview

我的第一个表有静态数据,在第二个表中,我是以编程方式添加数据。 我已经设置了滚动视图的两个表高度的内容大小总和,仍然无法正常工作。 它在iPhone的相应表格中向我展示了两个表格分别滚动。

在.xib中的

我已经采用了滚动视图,它包含两个UITableView。

 long int tbl1_height=([firstItemsArray count]*54)+280;
 long int tbl2_height=([arr_MainMorningTrackList1 count]*54);
 [self.tbl_1 setFrame:CGRectMake(0, 0, 320, tbl1_height)];
[self.tbl_2 setFrame:CGRectMake(0, tbl1_height, 320, tbl2_height)]; 
long int scrollHeight=tbl1_height+tbl2_height; 
self.scroll_mainView.contentSize = CGSizeMake(320,scrollHeight+60); 
[self.tbl_2 reloadData];

感谢您的评论

1 个答案:

答案 0 :(得分:1)

经过一些搜索和尝试代码后,我找到了解决方案,我忘了删除我们的.xib文件中autolayout UITableView的复选标记。