I need to make UITaableView to fit its content.I m loading array data in UITableView.But when I fixed some static size ,eventhough the items are less it is showing the extra space.So I need to make dynamic height to UITableView but could not achieve it ..
autocompleteTableView = [[UITableView alloc] initWithFrame:CGRectMake(10, 140, 200, self.autocompleteTableView.contentSize.height) style:UITableViewStyleGrouped];
autocompleteTableView.delegate = self;
autocompleteTableView.dataSource = self;
autocompleteTableView.scrollEnabled = YES;
[self.view addSubview:autocompleteTableView];
When I write this I could not see the TableView itself..How can I get it ?
For
dynamic tableview height. You need to apply dynamic frame.For ex,
Where 44 is default size of tableview cell
Thus, you need to know each cell height, In order to apply this.
Enjoy Programming