본문 바로가기
#모바일 [Mobile]/iOS

[iOS] UITableView 셀 크기의 맞춰 높이 동적 설정 (Resizing UITableView to fit content)

by cy_mos 2019. 6. 23.
반응형

📄 [iOS] UITableView DataSourceResizing UITableView to fit content Swift Source Code

var frame: CGRect = self.movieUserCommentTableView.frame
frame.size.height = self.movieUserCommentTableView.contentSize.height
self.movieUserCommentTableView.frame = frame

📄 [iOS] UITableView DataSourceResizing UITableView to fit content Objective-C Source Code

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;
    });

🚀 REFERENCE

 

Resizing UITableView to fit content

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 t...

stackoverflow.com

 

반응형

댓글