ユーザーが各セルを展開または折りたたむことができるように、セルの高さを追跡するための UITableViewproperty(strong, nonatomic)NSMutableArray *currentContent
もあります。property(strong, nonatomic)NSMutableArray *cellHeights
はself.currentContent
、Web サービスからデータをロードする別のコントローラーによって設定されるため、データがロードされると変化します。これらの変数の両方を同期させたいと考えています。が更新され次第、currentContent
更新したいと思いcellHeights
ます。それ、どうやったら出来るの?
私は試した:
- (void)setCurrentContent:(NSMutableArray *)currentContent{
_currentContent = currentContent;
self.cellHeights = [NSMutableArray arrayWithDefaultHeightsForCellCount:[currentContent count]];
}
currentContent
しかし、それは機能していません。最初に設定したとき、空のときにのみ設定されるからです。したがってself.cellHeights
、現在は空のままになります。最終的に値が にある場合はself.currentContent
、self.cellHeights
更新されませんでした。