我有我的UITableView自定義單元格。我在我的手機上放了一個左右滑動的觀察者。其中如果用戶在單元格上滑動,它將調用一個函數。這個函數基本上創建了需要添加到單元格中的UIView。自定義單元格和UITableViewController建議
我想我的代碼使用MVC最佳實踐。所以我認爲最合適的做法是將UIView傳遞給自定義單元格,並讓我的自定義單元格實現將其添加到單元格中。在我的自定義單元格中,我也有UIView的屬性。
問題是我還需要調整單元的高度。現在,我有方法是:
+ (CGFloat)tableView:(UITableView *)tableView rowHeightForObject:(id)item {
}
這是不是索引路徑它的對象類似於常規heightForRowAtIndexPath。在這個方法中,我需要確定是否存在需要添加的UIView。如果有,高度需要根據這個進行調整。我似乎無法解決這個問題。在這種方法中,我不能做self.optionsView,或訪問我的自定義單元格子類中的任何屬性。那麼如何檢查選項是否被添加?
,因爲我用rowHeightForObject這是不行的,這裏有沒有indexPath – adit
那麼你不能將數據添加到對象,像USER_INFO字典或喜歡? – Idan