I have a view. It is structured like this:
-View
-Scroll view
-TableView
-TableView Cell
I cannot resize the table and cannot set cell’s heights. The cell contents are dynamic text from json. I can get their lengths but I have a problem with referencing the table and the cells. In my header I have this:
@interface ListingDetailController : UIViewController <UITableViewDelegate,UITableViewDataSource> {
In IB, the tableview’s datasource is the Rootview, and delegated from scrollview, which itself is a delegate of the view.
I want to use the following code for example:
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
CGSize size = [[rows4 objectAtIndex:indexPath.row]
sizeWithFont:[UIFont systemFontOfSize:14]
constrainedToSize:CGSizeMake(300, CGFLOAT_MAX)];
return size.height + 10;
}
But it doesn’t affect my table at all. Nothing changes. I can’t event create the table programmatically, because it is inside a scrollview so I cannot create it with coords. If I do it goes outside the scrollview.
Would anyone recommend a way to handle this?
You can create scroll view and tableview by programmatically. Just you have to add your tableview into scrollview. just you have to set the coordinate according to scrollview.