UITableView根据内容动态自动调整高度.我尝试了以下解决方案,但对我不起作用:
dispatch_async(dispatch_get_main_queue()) {
//This code will run in the main thread:
CGRect frame = self.tableView.frame;
frame.size.height = self.tableView.contentSize.height;
self.tableView.frame = frame;
}
Run Code Online (Sandbox Code Playgroud)