Fixes to extension view

[FIX]: flexible width extension view by default
[NEW]: add cleanup method again
This commit is contained in:
Mazyad Alabduljaleel 2014-06-17 15:23:52 +04:00
parent 3f82e33642
commit a69bb8bdc3
2 changed files with 17 additions and 3 deletions

View File

@ -52,6 +52,8 @@
- (void)layoutViews;
/* Needs to be called in two places.. Please refer to the demo */
- (void)scrollViewDidEndScrolling;
/* Needs to be called on viewWillDisappear */
- (void)cleanup;
@end

View File

@ -66,6 +66,7 @@ static inline CGFloat AACStatusBarHeight()
self.extensionViewContainer = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100.f, 0.f)];
self.extensionViewContainer.backgroundColor = [UIColor clearColor];
self.extensionViewContainer.autoresizingMask = UIViewAutoresizingFlexibleWidth|UIViewAutoresizingFlexibleBottomMargin;
self.extensionController = [[TLYShyViewController alloc] init];
self.extensionController.view = self.extensionViewContainer;
@ -193,9 +194,15 @@ static inline CGFloat AACStatusBarHeight()
- (void)setExtensionView:(UIView *)view
{
// TODO: expand the container instead of just adding it on top
self.extensionViewContainer.frame = view.bounds;
[self.extensionViewContainer addSubview:view];
if (view != [self.extensionViewContainer.subviews firstObject])
{
[[self.extensionViewContainer.subviews firstObject] removeFromSuperview];
// TODO: expand the container instead of just adding it on top
self.extensionViewContainer.frame = view.bounds;
[self.extensionViewContainer addSubview:view];
[self layoutViews];
}
}
- (void)prepareForDisplay
@ -214,6 +221,11 @@ static inline CGFloat AACStatusBarHeight()
self.scrollView.scrollIndicatorInsets = scrollInsets;
}
- (void)cleanup
{
[self.navBarController expand];
}
- (void)scrollViewDidEndScrolling
{
[self _handleScrollingEnded];