Skip to content

Commit

Permalink
Deleted ivar declarations for headerView and footerView. Using footVi…
Browse files Browse the repository at this point in the history
…ew property instead of ivar.
  • Loading branch information
jagreenwood committed Nov 10, 2012
1 parent 06c0530 commit 540df5d
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 18 deletions.
2 changes: 0 additions & 2 deletions lib/UIKit/TUITableView.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,6 @@ typedef enum {
NSArray * _sectionInfo;

TUIView * _pullDownView;
TUIView * _headerView;
TUIView * _footerView;

CGSize _lastSize;
CGFloat _contentHeight;
Expand Down
26 changes: 10 additions & 16 deletions lib/UIKit/TUITableView.m
Original file line number Diff line number Diff line change
Expand Up @@ -288,7 +288,7 @@ - (void)_updateSectionInfo {
[sections addObject:section];
}

_contentHeight = (offset - self.contentInset.bottom) + _footerView.bounds.size.height;
_contentHeight = (offset - self.contentInset.bottom) + self.footerView.bounds.size.height;
_sectionInfo = sections;

}
Expand Down Expand Up @@ -649,11 +649,11 @@ - (void)setHeaderView:(TUIView *)h
}

- (void)setFooterView:(TUIView *)footerView {
[_footerView removeFromSuperview];
[self.footerView removeFromSuperview];
_footerView = footerView;

[self addSubview:_footerView];
_footerView.hidden = YES;
[self addSubview:self.footerView];
self.footerView.hidden = YES;
}

- (BOOL)_preLayoutCells
Expand Down Expand Up @@ -916,20 +916,14 @@ - (void)_layoutCells:(BOOL)visibleCellsNeedRelayout
}
}

if (_footerView) {
CGRect footerViewRect = CGRectMake(0, 0, visible.size.width, _footerView.frame.size.height);
if (self.footerView) {
CGRect footerViewRect = CGRectMake(0, 0, visible.size.width, self.footerView.frame.size.height);
if(CGRectIntersectsRect(footerViewRect, visible)) {
_footerView.frame = footerViewRect;
[_footerView setNeedsLayout];

if(_footerView.hidden) {
// show
_footerView.hidden = NO;
}
self.footerView.frame = footerViewRect;
[self.footerView setNeedsLayout];
self.footerView.hidden = NO;
} else {
if(!_footerView.hidden) {
_footerView.hidden = YES;
}
self.footerView.hidden = YES;
}
}
}
Expand Down

0 comments on commit 540df5d

Please sign in to comment.