I am creating an app which will have a question in a UILabel and a multiple choice answers displayed in UITableView, each row showing a multiple choice. Questions and answers will vary, so I need this UITableView to be dynamic in height.
I would like to find a sizeToFit work around for the table. Where the table's frame is set to the height of all it's content.
Can anyone advise on how I can achieve this?
Actually I found the answer myself.
I just create a new
CGRectfor thetableView.framewith theheightoftable.contentSize.heightThat sets the height of the
UITableViewto theheightof its content. Since the code modifies the UI, do not forget to run it in the main thread: