[英]What is the better way to resize UITableView Cells components
我有一個大問題,我試圖調整單元格及其內部兩個視圖的大小,但確實做到了,但是在顯示UITableView
時它顯示的很慢,我想這是發生的,因為在顯示之前該單元格應該做的所有事情起來
這是我要調整單元格及其內容大小的簡歷:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
調整單元格的大小- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
- (void)sizeForContent:(UICustomView*)contentView andCommentView:(UIOtherCustomView*)commentView forMessage:(MessageObject*)message
UIView
調整了標簽的大小 (我正在最后一步- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath
)
它應該生成,但是表運行緩慢!
這是我在每個單元格中生成的示例(僅當有信息要顯示時才顯示第二個視圖,始終顯示第一個視圖)
--------------------
| |
| First UIView |
| | UILabel | |
--------------------
| Second UIView |
| |
|----------------|
調整單元內所有組件大小的更好方法是什么? 有沒有辦法使用自動布局?
考慮改用UICollectionView
,因為它在布局和單元格大小方面設計得更加靈活。 基本功能與UITableView
非常相似。
有關集合視圖,請參閱Apple文檔: 關於UICollectionView
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.