Ios CollectionView中的TableView是否在滚动后设置帧?

Ios CollectionView中的TableView是否在滚动后设置帧?,ios,uitableview,uicollectionview,Ios,Uitableview,Uicollectionview,我正在使用UITableView内部UICollectionViewCell。我试图显示的是tableView的动态高度,这取决于UITableView中的单元格。但它的框架是在滚动UICollectionView后设置的。下面是我尝试的代码 #Pragma mark-CollectionView Methods -(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInt

我正在使用
UITableView
内部
UICollectionViewCell
。我试图显示的是
tableView
的动态高度,这取决于
UITableView
中的单元格。但它的框架是在滚动
UICollectionView
后设置的。下面是我尝试的代码

#Pragma mark-CollectionView Methods 
-(NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
return [_collectionViewLabelArray count];
}
-(UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{

UICollectionViewCell *myCell=[collectionView dequeueReusableCellWithReuseIdentifier:@"Cell" forIndexPath:indexPath];
UITableView *tableView=(UITableView*)[myCell viewWithTag:11];
tableView.delegate=self;
tableView.dataSource=self;
[tableView reloadData];
tableView.frame=CGRectMake(tableView.frame.origin.x, tableView.frame.origin.y, tableView.frame.size.width,tableView.contentSize.height);
    return myCell;
}
 -(CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout *)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath{


return CGSizeMake(950, [_tableViewDataArray count]*44);
}
#pragma mark-TableView Methods
 -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return [_tableViewDataArray count];
 }
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *myCell=[tableView dequeueReusableCellWithIdentifier:@"Cell"];


myCell.textLabel.text=[_tableViewDataArray objectAtIndex:indexPath.row];
   return myCell;

 }

设置tableView框架后重新加载tableView

tableView.frame=CGRectMake(tableView.frame.origin.x, tableView.frame.origin.y, tableView.frame.size.width,tableView.contentSize.height);
[tableView reloadData];

需要设置tableView的高度是什么?我正在尝试设置动态高度。此外,数据将从JSON中提取。因此,我必须显示
tableView
的动态高度(根据我的要求,我不需要滚动
tableView
)不,它没有显示任何效果。显示与前一个相同的行为。一旦更改tableView对象的名称而不是tableView。