Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
[UI] tableView banner gets assigned the overlay view's frame.
Browse files Browse the repository at this point in the history
Instead of using the overlayview method, craft a new one which specifically
handles the bannerview. Additionally adjust scrollindicator and
content insets.

Closes #103
  • Loading branch information
diederich authored and jverkoey committed Nov 5, 2010
1 parent 95fe9ed commit 70902b1
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion src/Three20UI/Sources/TTTableViewController.m
Expand Up @@ -161,6 +161,14 @@ - (void)resetOverlayView {
}
}

///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)addSubviewOverTableView:(UIView*)view {
NSInteger tableIndex = [_tableView.superview.subviews
indexOfObject:_tableView];
if (NSNotFound != tableIndex) {
[_tableView.superview addSubview:view];
}
}

///////////////////////////////////////////////////////////////////////////////////////////////////
- (void)layoutOverlayView {
Expand Down Expand Up @@ -646,9 +654,14 @@ - (void)setTableBannerView:(UIView*)tableBannerView animated:(BOOL)animated {
_tableBannerView = [tableBannerView retain];

if (_tableBannerView) {
self.tableView.contentInset = UIEdgeInsetsMake(0, 0, TTSTYLEVAR(tableBannerViewHeight), 0);
self.tableView.scrollIndicatorInsets = self.tableView.contentInset;
_tableBannerView.frame = [self rectForBannerView];
_tableBannerView.userInteractionEnabled = NO;
[self addToOverlayView:_tableBannerView];
_tableBannerView.autoresizingMask = (UIViewAutoresizingFlexibleWidth
| UIViewAutoresizingFlexibleTopMargin);
[self addSubviewOverTableView:_tableBannerView];


if (animated) {
_tableBannerView.top += TTSTYLEVAR(tableBannerViewHeight);
Expand All @@ -658,6 +671,10 @@ - (void)setTableBannerView:(UIView*)tableBannerView animated:(BOOL)animated {
_tableBannerView.top -= TTSTYLEVAR(tableBannerViewHeight);
[UIView commitAnimations];
}

} else {
self.tableView.contentInset = UIEdgeInsetsZero;
self.tableView.scrollIndicatorInsets = UIEdgeInsetsZero;
}
}
}
Expand Down

0 comments on commit 70902b1

Please sign in to comment.