@@ -100,9 +100,9 @@ - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger
100100- (CGFloat)tableView : (UITableView *)tableView heightForRowAtIndexPath : (NSIndexPath *)indexPath {
101101 BOTableViewSection *section = self.sections [indexPath.section];
102102 BOTableViewCell *cell = section.cells [indexPath.row];
103- CGFloat cellHeight = MAX (self.tableView .estimatedRowHeight , [self heightForCell: cell]);
104103
105- cell.layoutMargins = UIEdgeInsetsMake (cellHeight, cell.layoutMargins .left , cell.layoutMargins .bottom , cell.layoutMargins .right );
104+ CGFloat cellHeight = MAX (self.tableView .estimatedRowHeight , [self heightForCell: cell]);
105+ cell.height = cellHeight;
106106
107107 if ([self .expansionIndexPath isEqual: indexPath]) {
108108 cellHeight += [cell expansionHeight ];
@@ -114,15 +114,13 @@ - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPa
114114- (CGFloat)heightForCell : (UITableViewCell *)cell {
115115
116116 UITableViewCell *cleanCell = [[UITableViewCell alloc ] initWithStyle: UITableViewCellStyleDefault reuseIdentifier: nil ];
117- cleanCell.layoutMargins = cell.layoutMargins ;
118- cleanCell.frame = cell.frame ;
117+ cleanCell.frame = CGRectMake (0 , 0 , cell.frame .size .width , 0 );
119118 cleanCell.textLabel .numberOfLines = 0 ;
120119 cleanCell.textLabel .text = cell.textLabel .text ;
121- cleanCell.detailTextLabel .text = cell.detailTextLabel .text ;
122120 cleanCell.accessoryView = cell.accessoryView ;
123121 cleanCell.accessoryType = cell.accessoryType ;
124122
125- CGFloat height = [cleanCell systemLayoutSizeFittingSize: CGSizeMake ( cleanCell.frame.size.width, UITableViewAutomaticDimension) ].height ;
123+ CGFloat height = [cleanCell systemLayoutSizeFittingSize: cleanCell.frame.size].height ;
126124
127125 return height;
128126}
@@ -133,13 +131,17 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
133131 cell.indexPath = indexPath;
134132
135133 if (cell.setting && !cell.setting .valueDidChangeBlock ) {
136- [UIView performWithoutAnimation: ^{
137- __unsafe_unretained typeof (self) weakSelf = self ;
138- __unsafe_unretained typeof ( cell) weakCell = cell;
139- cell. setting . valueDidChangeBlock = ^{
134+ __unsafe_unretained typeof (self) weakSelf = self;
135+ __unsafe_unretained typeof (cell) weakCell = cell ;
136+ cell. setting . valueDidChangeBlock = ^{
137+ dispatch_async ( dispatch_get_main_queue (), ^{
140138 [weakCell settingValueDidChange ];
141139 [weakSelf reloadTableView ];
142- };
140+ });
141+ };
142+
143+ [UIView performWithoutAnimation: ^{
144+ [cell settingValueDidChange ];
143145 }];
144146 }
145147
@@ -199,6 +201,7 @@ - (NSArray *)footerViews {
199201- (CGFloat)tableView : (UITableView *)tableView heightForFooterInSection : (NSInteger )section {
200202 UITableViewHeaderFooterView *footerView = self.footerViews [section];
201203 footerView.textLabel .text = [self tableView: tableView titleForFooterInSection: section];
204+ // Super hacky code for iOS 9 support.
202205 footerView.textLabel .numberOfLines = 0 ;
203206 CGPoint previousOrigin = footerView.textLabel .frame .origin ;
204207 [footerView sizeToFit ];
@@ -241,12 +244,6 @@ - (void)tableView:(UITableView *)tableView willDisplayFooterView:(UITableViewHea
241244 if (section.footerTitleFont ) footerView.textLabel .font = section.footerTitleFont ;
242245}
243246
244- - (void )willTransitionToTraitCollection : (UITraitCollection *)newCollection withTransitionCoordinator : (id <UIViewControllerTransitionCoordinator>)coordinator {
245- [coordinator animateAlongsideTransition: nil completion: ^(id <UIViewControllerTransitionCoordinatorContext> context) {
246- [self .tableView reloadData ];
247- }];
248- }
249-
250247#pragma mark Subclassing
251248
252249- (void )setup {}
0 commit comments