diff --git a/README.md b/README.md
index 5fa3f39..5ed57cc 100644
--- a/README.md
+++ b/README.md
@@ -1,10 +1,12 @@
-# TLYShyNavBar
+![TLYShyNavBar banner](http://imgur.com/UVxJLxu.png)
+__v1.0, Finally! With better code design, and fully featured!__
+-----
![Pod Version](https://cocoapod-badges.herokuapp.com/v/TLYShyNavBar/badge.png)
![Pod License](https://img.shields.io/badge/license-MIT-blue.svg)
-This component helps you mimick the navigation bar auto scrolling that you see in the facebook, instagram and other apps. Not only that, but with the ability to add an additional extension that scrolls along as well! It is designed for **ease of use**, and is battle tested in our own [Telly app](https://itunes.apple.com/us/app/telly/id524552885?mt=8)[1]!
+This component helps you mimic the navigation bar auto scrolling that you see in the Facebook, Instagram, 9gag (which uses this!) and other apps. Not only that, but with the ability to add an additional extension that scrolls along as well! It is designed for **ease of use**, and is battle tested in our own [Telly app](https://itunes.apple.com/us/app/telly/id524552885?mt=8)[1]!
![Battle Tested!!](resources/battle-tested-demo.gif)
@@ -19,23 +21,24 @@ This component helps you mimick the navigation bar auto scrolling that you see i
+ **[A Deeper Look](#a-deeper-look)**: You're invensted in this now and want to make the most out of it.
+ **[How it Works](#how-it-works)**: The deep stuff...
+ **[Remarks](#remarks)**: Read this before losing all hope.
-+ **[Contributors](#contributors)**: Developers that donated their valuable time.
++ **[Contributing](#contributing)**: Together, making iOS better.
+ **[Author](#author)**: Watashi-da!
+ **[Similar Projects](#similar-projects)**: Similar projects that influenced the project in some way.
## Features
| Feature | Demo |
-|---------|---------------------------------------------------------------------------------------------------------
-| Optional extension view to the `UINavigationBar`! | ![](resources/ShyNavBar-1.gif) |
-| Auto expand if below threshold | ![](resources/ShyNavBar-2.gif) |
-| Auto contract if below threshold | ![](resources/ShyNavBar-3.gif) |
-| Very responsive, resilient and robust | ![](resources/ShyNavBar-4.gif) |
-| Adjustable expansion resistance | ![](resources/ShyNavBar-5.gif) |
-| Plays well with `pushViewController` | ![](resources/ShyNavBar-6.gif) |
-| Sticky extension view (Thanks @yukaliao !) | ![](resources/ShyNavBar-7.gif) |
-| Sticky navigation bar (Thanks [@TiagoVeloso](https://github.com/TiagoVeloso)!) | ![](resources/ShyNavBar-9.gif) |
-| Fade the entire navbar (Thanks [__@longsview__](https://github.com/longsview)!) | ![](resources/ShyNavBar-8.gif) |
+|---|---|
+| Scroll a `UINavigationBar` with an extension view | ![](resources/basic-feature.gif) |
+| Support opaque and translucent `UINavigationBar`s | ![](resources/opaque-supported.gif) |
+| Fully featured, with animations and variable resistance | ![](resources/fully-featured.gif) |
+| Responsive, resilient and robust | ![](resources/robust.gif) |
+| Supports `UITableView`, with headers, too! | ![](resources/tableview.gif) |
+| `UICollectionView` is more than welcome | ![](resources/collectionView.gif) |
+| In-call status bar? No problem! | ![](resources/in-app-call.gif) |
+| Sticky extension view (Thanks @yukaliao !) | ![](resources/sticky-extension.gif) |
+| Sticky navigation bar (Thanks [@TiagoVeloso](https://github.com/TiagoVeloso)!) | ![](resources/sticky-navbar.gif) |
+| Fade the entire navbar (Thanks [__@longsview__](https://github.com/longsview)!) | ![](resources/fade-navbar.gif) |
You can test some of these features in the Objective-C demo:
@@ -60,34 +63,20 @@ You can test some of these features in the Objective-C demo:
self.shyNavBarManager.scrollView = self.scrollView;
```
-**IMPORTANT!!** If you are assigning a delegate to your scrollView, do that **before** assigning the scrollView to the `TLYShyNavBarManager`! To learn more, [see below](#how-it-works).
+**IMPORTANT NOTES!!**
-### Using TLYShyNavBar in Swift
-If you are building apps in Swift and targeting apps to iOS7 Apples [hidesBarsOnSwipe](https://developer.apple.com/library/ios/documentation/UIKit/Reference/UINavigationController_Class/#//apple_ref/occ/instp/UINavigationController/hidesBarsOnSwipe) will not work because it is in an iOS 8 feature. As an alternative you can use TLYShyNavBar component in lieu of Apples feature.
-
-To use this component in Swift
-
-1. Clone this git repository locally: `git clone https://github.com/telly/TLYShyNavBar.git`
-2. Copy the `TLYShyNavBar` directory into your Swift project.
![](resources/Swift-project.png)
-3. Create a new header file called `Bridging-Header.h` and add the headers from `TLYShyNavBar` folder.[see headers below](#bridge-headers).
-4. Add the bridging header file to the project's build settings. Search `Bridging Header` in `Build Settings` and add `Bridging-Header.h`.
![](resources/Bridged-Header.png)
+1. Don't use with `UITableViewController`. Add a `UITableView` as a subview of `UIViewController` instead.
+2. If you are assigning a delegate to your scrollView, do that **before** assigning the scrollView to the `TLYShyNavBarManager`! To learn more, [see below](#how-it-works).
-Now your project is setup to use the TLYShyNavBar component. Next all you need to do is set the scrollview property in your UIViewController like it was an Objective-c project.
+### Using TLYShyNavBar in Swift
-```
-/* In your UIViewController viewDidLoad or after creating the scroll view. */
-self.shyNavBarManager.scrollView = self.scrollView;
-```
+Nothing special is needed, really. Just make sure you have a [Bridging Header](http://stackoverflow.com/questions/31716413/xcode-not-automatically-creating-bridging-header) setup, and import:
-#### Bridge Headers
-```
+```objc
#import "TLYShyNavBarManager.h"
-#import "TLYShyViewController.h"
-#import "TLYDelegateProxy.h"
-#import "NSObject+TLYSwizzlingHelpers.h"
-#import "UIViewController+BetterLayoutGuides.h"
```
+Then, you should be able to follow the Objective-C instructions, since the code is almost identical.
## Design Goals
@@ -97,7 +86,7 @@ self.shyNavBarManager.scrollView = self.scrollView;
## A Deeper Look
-The above example, while small, is complete! It makes the navigation bar enriched with humbility, that it will start getting out of the way when the scroll view starts scrolling. But, you may want to do more than that!
+The above example, while small, is complete! It makes the navigation bar enriched with humility, that it will start getting out of the way when the scroll view starts scrolling. But, you may want to do more than that!
#### ACCESS THE MANAGER OF SHYNESS
@@ -137,6 +126,17 @@ You can control that using the following properties on the `shyNavBarManager`:
@property (nonatomic) CGFloat contractionResistance; // default 0
```
+#### CONTROLLING THE FADE BEHAVIOR
+
+You can customize the fade behavior of the `UINavigationBar` through this property:
+
+```objc
+/* Choose how the navbar fades as it contracts/expands.
+ * Defaults to FadeSubviews
+ */
+@property (nonatomic) TLYShyNavBarFade fadeBehavior;
+```
+
## How it Works
OK, I'll admit that I added this section purely to rant about how this project came together, and the decision making process behind it.
@@ -187,10 +187,10 @@ We also add a parent relationship for a single purpose: Make the child follow it
## Remarks
-There are downsides in making this component as easy to use as it is. If you have read the how it works section carefully, you'd realize that trying to configure the the `shyNavBarManager` before it is included in the `UINavigationController` heirarchy, will break the component, since within the component, we cannot find the navigation bar, and an assert is triggered:
+There are downsides in making this component as easy to use as it is. If you have read the how it works section carefully, you'd realize that trying to configure the the `shyNavBarManager` before it is included in the `UINavigationController` hierarchy, will break the component, since within the component, we cannot find the navigation bar, and an assert is triggered:
```objc
-NSAssert(navbar != nil, @"You are using the component wrong... Please see the README file.");
+NSAssert(navbar != nil, @"Please make sure the viewController is already attached to a navigation controller.");
```
Of course, that can be avoided by creating your own `TLYShyNavBarManager`, like so:
@@ -203,27 +203,13 @@ shyManager.expansionResistance = 777.f;
viewController.shyNavBarManager = shyManager;
```
-## Contributors
-
-Thanks for everyone who opened an issue, shot me an email, and submitted a PR. Special thanks to those who submitted code that got checked in!
-
-_Sorted vaguely based on contribution according to [this](http://www.commandlinefu.com/commands/view/4519/list-all-authors-of-a-particular-git-project)_
-
-+ Evan D. Schoenberg, M.D
-+ Tony Nuzzi
-+ Xurxo Méndez Pérez
-+ Richard Das
-+ Garret Riddle
-+ Aleksey Kozhevnikov
-+ modastic
-+ Yukan
-+ Remigiusz Herba
-+ Nicholas Long
-+ Koen Buddelmeijer
-+ Anton Sokolchenko
-+ Andrii Novoselskyi
-+ Alek Slater
-+ Aaron Satterfield
+## Contributing
+
+PRs are welcome! It is important to test changes, though. Simply go over the demo, make sure nothing is broken. Please do check both translucent and opaque modes. Once all is good, you're good to go!
+
+If it is a feature or bug, it would be greatly appreciated if a new view is added to the demo project demonstrating the bug/feature.
+
+Thanks for everyone who opened an issue, shot me an email, and submitted a PR. Special thanks to those who submitted code that got checked in! This project was made possible with your help. ([See contributors graph](https://github.com/telly/TLYShyNavBar/graphs/contributors))
## Author
diff --git a/TLYShyNavBar/Categories/UIScrollView+Helpers.h b/TLYShyNavBar/Categories/UIScrollView+Helpers.h
index b2f9a22..ed2ca1c 100644
--- a/TLYShyNavBar/Categories/UIScrollView+Helpers.h
+++ b/TLYShyNavBar/Categories/UIScrollView+Helpers.h
@@ -11,6 +11,6 @@
@interface UIScrollView (Helpers)
-- (void)tly_smartSetInsets:(UIEdgeInsets)contentAndScrollIndicatorInsets;
+- (void)tly_setInsets:(UIEdgeInsets)contentInsets preserveOffset:(BOOL)preserveOffset;
@end
diff --git a/TLYShyNavBar/Categories/UIScrollView+Helpers.m b/TLYShyNavBar/Categories/UIScrollView+Helpers.m
index 30824e6..214ec06 100644
--- a/TLYShyNavBar/Categories/UIScrollView+Helpers.m
+++ b/TLYShyNavBar/Categories/UIScrollView+Helpers.m
@@ -10,17 +10,20 @@
@implementation UIScrollView (Helpers)
-// Modify contentInset and scrollIndicatorInsets while preserving visual content offset
-- (void)tly_smartSetInsets:(UIEdgeInsets)contentAndScrollIndicatorInsets
+// Modify contentInset and scrollIndicatorInsets
+- (void)tly_setInsets:(UIEdgeInsets)contentInsets preserveOffset:(BOOL)preserveOffset
{
- if (contentAndScrollIndicatorInsets.top != self.contentInset.top)
+ if (preserveOffset && contentInsets.top != self.contentInset.top)
{
- CGPoint contentOffset = self.contentOffset;
- contentOffset.y -= contentAndScrollIndicatorInsets.top - self.contentInset.top;
- self.contentOffset = contentOffset;
+ CGFloat offsetDelta = contentInsets.top - self.contentInset.top;
+
+ CGRect bounds = self.bounds;
+ bounds.origin.y -= offsetDelta;
+ self.bounds = bounds;
}
- self.contentInset = self.scrollIndicatorInsets = contentAndScrollIndicatorInsets;
+ self.contentInset = contentInsets;
+ self.scrollIndicatorInsets = contentInsets;
}
@end
diff --git a/TLYShyNavBar/ShyControllers/TLYShyChild.h b/TLYShyNavBar/ShyControllers/TLYShyChild.h
new file mode 100644
index 0000000..8833054
--- /dev/null
+++ b/TLYShyNavBar/ShyControllers/TLYShyChild.h
@@ -0,0 +1,19 @@
+//
+// TLYShyChild.h
+// TLYShyNavBarDemo
+//
+// Created by Mazyad Alabduljaleel on 11/13/15.
+// Copyright © 2015 Telly, Inc. All rights reserved.
+//
+
+#ifndef TLYShyChild_h
+#define TLYShyChild_h
+
+
+@protocol TLYShyChild
+
+- (void)offsetCenterBy:(CGPoint)deltaPoint;
+
+@end
+
+#endif /* TLYShyChild_h */
diff --git a/TLYShyNavBar/ShyControllers/TLYShyParent.h b/TLYShyNavBar/ShyControllers/TLYShyParent.h
index 19ae43b..d54fad6 100644
--- a/TLYShyNavBar/ShyControllers/TLYShyParent.h
+++ b/TLYShyNavBar/ShyControllers/TLYShyParent.h
@@ -9,10 +9,15 @@
#ifndef TLYShyParent_h
#define TLYShyParent_h
-@protocol TLYShyParent
+#import
-@property (nonatomic, readonly) CGFloat viewMaxY;
+/** A shy parent can be asked for its maxY and height so the
+ * child can pin itself to the bottom and calculate the total
+ * height.
+ */
+@protocol TLYShyParent
+- (CGFloat)maxYRelativeToView:(UIView *)superview;
- (CGFloat)calculateTotalHeightRecursively;
@end
diff --git a/TLYShyNavBar/ShyControllers/TLYShyScrollViewController.h b/TLYShyNavBar/ShyControllers/TLYShyScrollViewController.h
new file mode 100644
index 0000000..dc3b82f
--- /dev/null
+++ b/TLYShyNavBar/ShyControllers/TLYShyScrollViewController.h
@@ -0,0 +1,22 @@
+//
+// TLYShyScrollViewController.h
+// TLYShyNavBarDemo
+//
+// Created by Mazyad Alabduljaleel on 11/13/15.
+// Copyright © 2015 Telly, Inc. All rights reserved.
+//
+
+#import
+#import "TLYShyViewController.h"
+#import "TLYShyParent.h"
+#import "TLYShyChild.h"
+
+
+@interface TLYShyScrollViewController : NSObject
+
+@property (nonatomic, weak) UIScrollView *scrollView;
+@property (nonatomic, weak) TLYShyViewController *parent;
+
+- (CGFloat)updateLayoutIfNeeded:(BOOL)intelligently;
+
+@end
diff --git a/TLYShyNavBar/ShyControllers/TLYShyScrollViewController.m b/TLYShyNavBar/ShyControllers/TLYShyScrollViewController.m
new file mode 100644
index 0000000..789c0a7
--- /dev/null
+++ b/TLYShyNavBar/ShyControllers/TLYShyScrollViewController.m
@@ -0,0 +1,55 @@
+//
+// TLYShyScrollViewController.m
+// TLYShyNavBarDemo
+//
+// Created by Mazyad Alabduljaleel on 11/13/15.
+// Copyright © 2015 Telly, Inc. All rights reserved.
+//
+
+#import "TLYShyScrollViewController.h"
+#import "../Categories/UIScrollView+Helpers.h"
+
+
+@implementation TLYShyScrollViewController
+
+- (void)offsetCenterBy:(CGPoint)deltaPoint
+{
+ [self updateLayoutIfNeeded:NO];
+}
+
+- (CGFloat)updateLayoutIfNeeded:(BOOL)intelligently
+{
+ if (self.scrollView.contentSize.height < FLT_EPSILON
+ && ([self.scrollView isKindOfClass:[UITableView class]]
+ || [self.scrollView isKindOfClass:[UICollectionView class]])
+ )
+ {
+ return 0.f;
+ }
+
+ CGFloat parentMaxY = [self.parent maxYRelativeToView:self.scrollView.superview];
+ CGFloat normalizedY = parentMaxY - self.scrollView.frame.origin.y;
+ UIEdgeInsets insets = self.scrollView.contentInset;
+ insets.top = normalizedY;
+
+ if (normalizedY > -FLT_EPSILON && !UIEdgeInsetsEqualToEdgeInsets(insets, self.scrollView.contentInset))
+ {
+ CGFloat delta = insets.top - self.scrollView.contentInset.top;
+ [self.scrollView tly_setInsets:insets preserveOffset:intelligently];
+
+ return delta;
+ }
+
+ if (normalizedY < -FLT_EPSILON)
+ {
+ CGRect frame = self.scrollView.frame;
+ frame = UIEdgeInsetsInsetRect(frame, insets);
+
+ self.scrollView.frame = frame;
+ return [self updateLayoutIfNeeded:YES];
+ }
+
+ return 0.f;
+}
+
+@end
diff --git a/TLYShyNavBar/ShyControllers/TLYShyStatusBarController.m b/TLYShyNavBar/ShyControllers/TLYShyStatusBarController.m
index 86e1377..4e9252c 100644
--- a/TLYShyNavBar/ShyControllers/TLYShyStatusBarController.m
+++ b/TLYShyNavBar/ShyControllers/TLYShyStatusBarController.m
@@ -54,7 +54,7 @@ - (CGFloat)_statusBarHeight
return statusBarHeight;
}
-- (CGFloat)viewMaxY
+- (CGFloat)maxYRelativeToView:(UIView *)superview
{
return [self _statusBarHeight];
}
diff --git a/TLYShyNavBar/ShyControllers/TLYShyViewController.h b/TLYShyNavBar/ShyControllers/TLYShyViewController.h
index 29406bc..dbc1600 100644
--- a/TLYShyNavBar/ShyControllers/TLYShyViewController.h
+++ b/TLYShyNavBar/ShyControllers/TLYShyViewController.h
@@ -9,6 +9,7 @@
#import
#import
#import "TLYShyParent.h"
+#import "TLYShyChild.h"
#import "../TLYShyNavBarFade.h"
@@ -29,16 +30,15 @@ typedef CGFloat(^TLYShyViewControllerContractionAmountBlock)(UIView *view);
* child to an already childified node is not supported.
*/
-@interface TLYShyViewController : NSObject
+@interface TLYShyViewController : NSObject
-@property (nonatomic, weak) TLYShyViewController *child;
+@property (nonatomic, weak) id child;
@property (nonatomic, weak) id parent;
+@property (nonatomic, weak) TLYShyViewController *subShyController;
@property (nonatomic, weak) UIView *view;
@property (nonatomic) TLYShyNavBarFade fadeBehavior;
-@property (nonatomic, readonly) CGFloat totalHeight;
-
/* Sticky means it will always stay in expanded state
*/
@property (nonatomic) BOOL sticky;
diff --git a/TLYShyNavBar/ShyControllers/TLYShyViewController.m b/TLYShyNavBar/ShyControllers/TLYShyViewController.m
index f7ceefd..0742836 100644
--- a/TLYShyNavBar/ShyControllers/TLYShyViewController.m
+++ b/TLYShyNavBar/ShyControllers/TLYShyViewController.m
@@ -11,9 +11,12 @@
@implementation TLYShyViewController (AsParent)
-- (CGFloat)viewMaxY
+- (CGFloat)maxYRelativeToView:(UIView *)superview
{
- return CGRectGetMaxY(self.view.frame);
+ CGPoint maxEdge = CGPointMake(0, CGRectGetHeight(self.view.bounds));
+ CGPoint normalizedMaxEdge = [superview convertPoint:maxEdge fromView:self.view];
+
+ return normalizedMaxEdge.y;
}
- (CGFloat)calculateTotalHeightRecursively
@@ -46,7 +49,7 @@ - (CGPoint)expandedCenterValue
CGPoint center = CGPointMake(CGRectGetMidX(self.view.bounds),
CGRectGetMidY(self.view.bounds));
- center.y += self.parent.viewMaxY;
+ center.y += [self.parent maxYRelativeToView:self.view.superview];
return center;
}
@@ -71,11 +74,6 @@ - (BOOL)expanded
return fabs(self.view.center.y - self.expandedCenterValue.y) < FLT_EPSILON;
}
-- (CGFloat)totalHeight
-{
- return self.child.totalHeight + (self.expandedCenterValue.y - self.contractedCenterValue.y);
-}
-
#pragma mark - Private methods
- (void)_onAlphaUpdate:(CGFloat)alpha
@@ -145,37 +143,45 @@ - (void)setFadeBehavior:(TLYShyNavBarFade)fadeBehavior
- (void)offsetCenterBy:(CGPoint)deltaPoint
{
- [self.child offsetCenterBy:deltaPoint];
-
self.view.center = CGPointMake(self.view.center.x + deltaPoint.x,
self.view.center.y + deltaPoint.y);
+
+ [self.child offsetCenterBy:deltaPoint];
}
- (CGFloat)updateYOffset:(CGFloat)deltaY
{
- if (self.child && !self.child.sticky && deltaY < 0)
+ if (self.subShyController && deltaY < 0)
{
- deltaY = [self.child updateYOffset:deltaY];
- self.child.view.hidden = deltaY < 0;
+ deltaY = [self.subShyController updateYOffset:deltaY];
}
- CGFloat newYOffset = self.view.center.y + deltaY;
- CGFloat newYCenter = MAX(MIN(self.expandedCenterValue.y, newYOffset), self.contractedCenterValue.y);
-
- [self _updateCenter:CGPointMake(self.expandedCenterValue.x, newYCenter)];
-
- CGFloat newAlpha = 1.f - (self.expandedCenterValue.y - self.view.center.y) / self.contractionAmountValue;
- newAlpha = MIN(MAX(FLT_EPSILON, newAlpha), 1.f);
-
- [self _onAlphaUpdate:newAlpha];
+ CGFloat residual = deltaY;
- CGFloat residual = newYOffset - newYCenter;
+ if (!self.sticky)
+ {
+ CGFloat newYOffset = self.view.center.y + deltaY;
+ CGFloat newYCenter = MAX(MIN(self.expandedCenterValue.y, newYOffset), self.contractedCenterValue.y);
+
+ [self _updateCenter:CGPointMake(self.expandedCenterValue.x, newYCenter)];
+
+ CGFloat newAlpha = 1.f - (self.expandedCenterValue.y - self.view.center.y) / self.contractionAmountValue;
+ newAlpha = MIN(MAX(FLT_EPSILON, newAlpha), 1.f);
+
+ [self _onAlphaUpdate:newAlpha];
+
+ residual = newYOffset - newYCenter;
+
+ // QUICK FIX: Only the extensionView is hidden
+ if (!self.subShyController)
+ {
+ self.view.hidden = residual < 0;
+ }
+ }
- if (self.child && !self.child.sticky && deltaY > 0 && residual > 0)
+ if (self.subShyController && deltaY > 0 && residual > 0)
{
- CGFloat newResidual = [self.child updateYOffset:residual];
- self.child.view.hidden = newResidual - residual > FLT_EPSILON;
- residual = newResidual;
+ residual = [self.subShyController updateYOffset:residual];
}
return residual;
@@ -197,13 +203,13 @@ - (CGFloat)snap:(BOOL)contract
__block CGFloat deltaY;
[UIView animateWithDuration:0.2 animations:^
{
- if ((contract && self.child.contracted) || (!contract && !self.expanded))
+ if ((contract && self.subShyController.contracted) || (!contract && !self.expanded))
{
deltaY = [self contract];
}
else
{
- deltaY = [self.child expand];
+ deltaY = [self.subShyController expand];
}
}];
@@ -219,7 +225,7 @@ - (CGFloat)expand
CGFloat amountToMove = self.expandedCenterValue.y - self.view.center.y;
[self _updateCenter:self.expandedCenterValue];
- [self.child expand];
+ [self.subShyController expand];
return amountToMove;
}
@@ -228,8 +234,10 @@ - (CGFloat)contract
{
CGFloat amountToMove = self.contractedCenterValue.y - self.view.center.y;
+ [self _onAlphaUpdate:FLT_EPSILON];
+
[self _updateCenter:self.contractedCenterValue];
- [self.child contract];
+ [self.subShyController contract];
return amountToMove;
}
diff --git a/TLYShyNavBar/TLYShyNavBarManager.m b/TLYShyNavBar/TLYShyNavBarManager.m
index e795590..2a6710c 100644
--- a/TLYShyNavBar/TLYShyNavBarManager.m
+++ b/TLYShyNavBar/TLYShyNavBarManager.m
@@ -10,6 +10,7 @@
#import "ShyControllers/TLYShyViewController.h"
#import "ShyControllers/TLYShyStatusBarController.h"
+#import "ShyControllers/TLYShyScrollViewController.h"
#import "Categories/TLYDelegateProxy.h"
#import "Categories/UIViewController+BetterLayoutGuides.h"
@@ -29,17 +30,17 @@ @interface TLYShyNavBarManager ()
@property (nonatomic, strong) id statusBarController;
@property (nonatomic, strong) TLYShyViewController *navBarController;
@property (nonatomic, strong) TLYShyViewController *extensionController;
+@property (nonatomic, strong) TLYShyScrollViewController *scrollViewController;
@property (nonatomic, strong) TLYDelegateProxy *delegateProxy;
@property (nonatomic, strong) UIView *extensionViewContainer;
-@property (nonatomic) UIEdgeInsets previousScrollInsets;
-@property (nonatomic) CGFloat previousYOffset;
-@property (nonatomic) CGFloat resistanceConsumed;
+@property (nonatomic, assign) CGFloat previousYOffset;
+@property (nonatomic, assign) CGFloat resistanceConsumed;
@property (nonatomic, assign) BOOL contracting;
-@property (nonatomic) BOOL previousContractionState;
+@property (nonatomic, assign) BOOL previousContractionState;
@property (nonatomic, readonly) BOOL isViewControllerVisible;
@@ -56,6 +57,7 @@ - (instancetype)init
{
self.delegateProxy = [[TLYDelegateProxy alloc] initWithMiddleMan:self];
+ /* Initialize defaults */
self.contracting = NO;
self.previousContractionState = YES;
@@ -63,25 +65,31 @@ - (instancetype)init
self.contractionResistance = 0.f;
self.fadeBehavior = TLYShyNavBarFadeSubviews;
-
- self.previousScrollInsets = UIEdgeInsetsZero;
self.previousYOffset = NAN;
+ /* Initialize shy controllers */
self.statusBarController = [[TLYShyStatusBarController alloc] init];
-
+ self.scrollViewController = [[TLYShyScrollViewController alloc] init];
self.navBarController = [[TLYShyViewController alloc] init];
- self.navBarController.parent = self.statusBarController;
-
+
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;
- self.extensionController.parent = self.navBarController;
-
+
+ /* hierarchy setup */
+ /* StatusBar <-- navbar <-->> extension <--> scrollView
+ */
+ self.navBarController.parent = self.statusBarController;
self.navBarController.child = self.extensionController;
+ self.navBarController.subShyController = self.extensionController;
+ self.extensionController.parent = self.navBarController;
+ self.extensionController.child = self.scrollViewController;
+ self.scrollViewController.parent = self.extensionController;
+ /* Notification helpers */
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationDidBecomeActive:)
name:UIApplicationDidBecomeActiveNotification
@@ -113,9 +121,17 @@ - (void)setViewController:(UIViewController *)viewController
{
_viewController = viewController;
+ if ([viewController isKindOfClass:[UITableViewController class]]
+ || [viewController.view isKindOfClass:[UITableViewController class]])
+ {
+ NSLog(@"*** WARNING: Please consider using a UIViewController with a UITableView as a subview ***");
+ }
+
UIView *navbar = viewController.navigationController.navigationBar;
- NSAssert(navbar != nil, @"You are using the component wrong... Please see the README file.");
+ NSAssert(navbar != nil, @"Please make sure the viewController is already attached to a navigation controller.");
+ viewController.extendedLayoutIncludesOpaqueBars = YES;
+
[self.extensionViewContainer removeFromSuperview];
[self.viewController.view addSubview:self.extensionViewContainer];
@@ -134,12 +150,14 @@ - (void)setScrollView:(UIScrollView *)scrollView
}
_scrollView = scrollView;
+ self.scrollViewController.scrollView = scrollView;
if (_scrollView.delegate != self.delegateProxy)
{
self.delegateProxy.originalDelegate = _scrollView.delegate;
_scrollView.delegate = (id)self.delegateProxy;
}
+
[self cleanup];
[self layoutViews];
@@ -197,7 +215,7 @@ - (BOOL)_scrollViewIsSuffecientlyLong
{
CGRect scrollFrame = UIEdgeInsetsInsetRect(self.scrollView.bounds, self.scrollView.contentInset);
CGFloat scrollableAmount = self.scrollView.contentSize.height - CGRectGetHeight(scrollFrame);
- return (scrollableAmount > self.navBarController.totalHeight);
+ return (scrollableAmount > [self.extensionController calculateTotalHeightRecursively]);
}
- (BOOL)_shouldHandleScrolling
@@ -249,6 +267,9 @@ - (void)_handleScrolling
self.resistanceConsumed = 0;
}
+ // GTH: Calculate the exact point to avoid expansion resistance
+ // CGFloat statusBarHeight = [self.statusBarController calculateTotalHeightRecursively];
+
// 5 - Apply resistance
// 5.1 - Always apply resistance when contracting
if (self.contracting)
@@ -259,7 +280,7 @@ - (void)_handleScrolling
deltaY = MIN(0, availableResistance + deltaY);
}
// 5.2 - Only apply resistance if expanding above the status bar
- else if (self.scrollView.contentOffset.y > -[self.statusBarController calculateTotalHeightRecursively])
+ else if (self.scrollView.contentOffset.y > 0)
{
CGFloat availableResistance = self.expansionResistance - self.resistanceConsumed;
self.resistanceConsumed = MIN(self.expansionResistance, self.resistanceConsumed + deltaY);
@@ -268,7 +289,7 @@ - (void)_handleScrolling
}
// 6 - Update the navigation bar shyViewController
- self.navBarController.fadeBehavior = (TLYShyNavBarFade)self.fadeBehavior;
+ self.navBarController.fadeBehavior = self.fadeBehavior;
[self.navBarController updateYOffset:deltaY];
@@ -285,16 +306,7 @@ - (void)_handleScrollingEnded
}
self.resistanceConsumed = 0;
-
- CGFloat deltaY = [self.navBarController snap:self.contracting];
- CGPoint newContentOffset = self.scrollView.contentOffset;
-
- newContentOffset.y -= deltaY;
-
- [UIView animateWithDuration:0.2
- animations:^{
- self.scrollView.contentOffset = newContentOffset;
- }];
+ [self.navBarController snap:self.contracting];
}
#pragma mark - KVO
@@ -351,28 +363,17 @@ - (void)prepareForDisplay
- (void)layoutViews
{
- UIEdgeInsets scrollInsets = self.scrollView.contentInset;
- scrollInsets.top = [self.extensionController calculateTotalHeightRecursively];
-
- if (UIEdgeInsetsEqualToEdgeInsets(scrollInsets, self.previousScrollInsets))
+ if (fabs([self.scrollViewController updateLayoutIfNeeded:YES]) > FLT_EPSILON)
{
- return;
+ [self.navBarController expand];
+ [self.extensionViewContainer.superview bringSubviewToFront:self.extensionViewContainer];
}
-
- self.previousScrollInsets = scrollInsets;
-
- [self.navBarController expand];
- [self.extensionViewContainer.superview bringSubviewToFront:self.extensionViewContainer];
-
- [self.scrollView tly_smartSetInsets:scrollInsets];
}
- (void)cleanup
{
[self.navBarController expand];
-
self.previousYOffset = NAN;
- self.previousScrollInsets = UIEdgeInsetsZero;
}
#pragma mark - UIScrollViewDelegate methods
diff --git a/TLYShyNavBarDemo/TLYShyNavBarDemo.xcodeproj/project.pbxproj b/TLYShyNavBarDemo/TLYShyNavBarDemo.xcodeproj/project.pbxproj
index 78f168a..45bd9db 100644
--- a/TLYShyNavBarDemo/TLYShyNavBarDemo.xcodeproj/project.pbxproj
+++ b/TLYShyNavBarDemo/TLYShyNavBarDemo.xcodeproj/project.pbxproj
@@ -13,6 +13,7 @@
821A4D841BF6D89E00E675DB /* TLYShyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 821A4D831BF6D89E00E675DB /* TLYShyViewController.m */; };
821A4D881BF6DA2700E675DB /* UIScrollView+Helpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 821A4D871BF6DA2700E675DB /* UIScrollView+Helpers.m */; };
821A4D8B1BF6E5D400E675DB /* TLYDelegateProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 821A4D8A1BF6E5D400E675DB /* TLYDelegateProxy.m */; };
+ 821A4D901BF6F3DF00E675DB /* TLYShyScrollViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 821A4D8F1BF6F3DF00E675DB /* TLYShyScrollViewController.m */; };
8262C8551BD730DD00B610A0 /* TLYCollectionViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 8262C8541BD730DD00B610A0 /* TLYCollectionViewController.m */; };
8268FA13194DBA58004EC0E4 /* TLYShyNavBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 8268FA12194DBA58004EC0E4 /* TLYShyNavBarManager.m */; };
828F57201949C37B009EB8DD /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 828F571F1949C37B009EB8DD /* Foundation.framework */; };
@@ -58,6 +59,9 @@
821A4D891BF6E5D400E675DB /* TLYDelegateProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYDelegateProxy.h; sourceTree = ""; };
821A4D8A1BF6E5D400E675DB /* TLYDelegateProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLYDelegateProxy.m; sourceTree = ""; };
821A4D8C1BF6E5F300E675DB /* TLYShyNavBarFade.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TLYShyNavBarFade.h; sourceTree = ""; };
+ 821A4D8D1BF6EDE800E675DB /* TLYShyChild.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TLYShyChild.h; sourceTree = ""; };
+ 821A4D8E1BF6F3DF00E675DB /* TLYShyScrollViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYShyScrollViewController.h; sourceTree = ""; };
+ 821A4D8F1BF6F3DF00E675DB /* TLYShyScrollViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLYShyScrollViewController.m; sourceTree = ""; };
8262C8531BD730DD00B610A0 /* TLYCollectionViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYCollectionViewController.h; sourceTree = ""; };
8262C8541BD730DD00B610A0 /* TLYCollectionViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLYCollectionViewController.m; sourceTree = ""; };
8268FA11194DBA58004EC0E4 /* TLYShyNavBarManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYShyNavBarManager.h; sourceTree = ""; };
@@ -126,10 +130,13 @@
isa = PBXGroup;
children = (
821A4D801BF6D72900E675DB /* TLYShyParent.h */,
+ 821A4D8D1BF6EDE800E675DB /* TLYShyChild.h */,
821A4D7D1BF6D70100E675DB /* TLYShyStatusBarController.h */,
821A4D7E1BF6D70100E675DB /* TLYShyStatusBarController.m */,
821A4D821BF6D89E00E675DB /* TLYShyViewController.h */,
821A4D831BF6D89E00E675DB /* TLYShyViewController.m */,
+ 821A4D8E1BF6F3DF00E675DB /* TLYShyScrollViewController.h */,
+ 821A4D8F1BF6F3DF00E675DB /* TLYShyScrollViewController.m */,
);
path = ShyControllers;
sourceTree = "";
@@ -357,6 +364,7 @@
821A4D7F1BF6D70100E675DB /* TLYShyStatusBarController.m in Sources */,
828F57301949C37B009EB8DD /* TLYAppDelegate.m in Sources */,
829FEE001957DF620017E186 /* NSObject+TLYSwizzlingHelpers.m in Sources */,
+ 821A4D901BF6F3DF00E675DB /* TLYShyScrollViewController.m in Sources */,
828F57361949C37B009EB8DD /* TLYViewController.m in Sources */,
821A4D841BF6D89E00E675DB /* TLYShyViewController.m in Sources */,
8262C8551BD730DD00B610A0 /* TLYCollectionViewController.m in Sources */,
diff --git a/TLYShyNavBarDemo/TLYShyNavBarDemo/Base.lproj/Main.storyboard b/TLYShyNavBarDemo/TLYShyNavBarDemo/Base.lproj/Main.storyboard
index 3fd45bf..98bd88b 100644
--- a/TLYShyNavBarDemo/TLYShyNavBarDemo/Base.lproj/Main.storyboard
+++ b/TLYShyNavBarDemo/TLYShyNavBarDemo/Base.lproj/Main.storyboard
@@ -64,7 +64,7 @@
-
+
@@ -213,13 +213,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
@@ -348,7 +374,7 @@
-
+
@@ -390,7 +416,7 @@
-
+
@@ -582,6 +608,51 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/TLYShyNavBarDemo/TLYShyNavBarDemo/TLYMenuTableViewController.m b/TLYShyNavBarDemo/TLYShyNavBarDemo/TLYMenuTableViewController.m
index c18e3f2..8cc6f69 100644
--- a/TLYShyNavBarDemo/TLYShyNavBarDemo/TLYMenuTableViewController.m
+++ b/TLYShyNavBarDemo/TLYShyNavBarDemo/TLYMenuTableViewController.m
@@ -29,7 +29,7 @@ - (instancetype)initWithCoder:(NSCoder *)coder
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
- return 7;
+ return 8;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
@@ -38,4 +38,14 @@ - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(N
return [tableView dequeueReusableCellWithIdentifier:cellId forIndexPath:indexPath];
}
+#pragma mark - Action methods
+
+- (IBAction)translucencyToggled:(id)sender
+{
+ BOOL translucent = !self.navigationController.navigationBar.translucent;
+ self.navigationController.navigationBar.translucent = translucent;
+
+ [sender setTitle:translucent ? @"😏" : @"😎"];
+}
+
@end
diff --git a/TLYShyNavBarDemo/TLYShyNavBarDemo/TLYTableViewController.m b/TLYShyNavBarDemo/TLYShyNavBarDemo/TLYTableViewController.m
index 6f021fe..a3fae57 100644
--- a/TLYShyNavBarDemo/TLYShyNavBarDemo/TLYTableViewController.m
+++ b/TLYShyNavBarDemo/TLYShyNavBarDemo/TLYTableViewController.m
@@ -10,6 +10,8 @@
@interface TLYTableViewController ()
+@property (nonatomic, assign) IBInspectable BOOL shortScrollView;
+
@property (nonatomic, weak) IBOutlet UITableView *tableView;
@end
@@ -25,7 +27,6 @@ - (void)viewDidLoad
UIView *view = view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), 40.f)];
view.backgroundColor = [UIColor redColor];
-
/* Library code */
self.shyNavBarManager.scrollView = self.tableView;
/* Can then be remove by setting the ExtensionView to nil */
@@ -36,7 +37,7 @@ - (void)viewDidLoad
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
- return 6;
+ return self.shortScrollView ? 1 : 6;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
diff --git a/TLYShyNavBarDemo/TLYShyNavBarDemo/TLYViewController.m b/TLYShyNavBarDemo/TLYShyNavBarDemo/TLYViewController.m
index 83b0b4e..729a203 100644
--- a/TLYShyNavBarDemo/TLYShyNavBarDemo/TLYViewController.m
+++ b/TLYShyNavBarDemo/TLYShyNavBarDemo/TLYViewController.m
@@ -49,7 +49,7 @@ - (void)viewDidLoad
if (!self.disableExtensionView)
{
- view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), 100.f)];
+ view = [[UIView alloc] initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.view.bounds), 40.f)];
view.backgroundColor = [UIColor redColor];
UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem];
diff --git a/TLYShyNavBarSwiftDemo/Bridging-Header.h b/TLYShyNavBarSwiftDemo/Bridging-Header.h
index d398c43..91bf1e5 100644
--- a/TLYShyNavBarSwiftDemo/Bridging-Header.h
+++ b/TLYShyNavBarSwiftDemo/Bridging-Header.h
@@ -3,14 +3,12 @@
// TLYShyNavBarSwiftDemo
//
// Created by Tony Nuzzi on 2/22/15.
-// Copyright (c) 2015 Acktie, LLC. All rights reserved.
+// Copyright (c) 2015 Telly, Inc. All rights reserved.
//
#ifndef TLYShyNavBarSwiftDemo_Bridging_Header_h
#define TLYShyNavBarSwiftDemo_Bridging_Header_h
+
#import "TLYShyNavBarManager.h"
-#import "TLYShyViewController.h"
-#import "TLYDelegateProxy.h"
-#import "NSObject+TLYSwizzlingHelpers.h"
-#import "UIViewController+BetterLayoutGuides.h"
+
#endif
diff --git a/TLYShyNavBarSwiftDemo/TLYShyNavBarSwiftDemo.xcodeproj/project.pbxproj b/TLYShyNavBarSwiftDemo/TLYShyNavBarSwiftDemo.xcodeproj/project.pbxproj
index b97cd3b..b6cfa5d 100644
--- a/TLYShyNavBarSwiftDemo/TLYShyNavBarSwiftDemo.xcodeproj/project.pbxproj
+++ b/TLYShyNavBarSwiftDemo/TLYShyNavBarSwiftDemo.xcodeproj/project.pbxproj
@@ -7,17 +7,20 @@
objects = {
/* Begin PBXBuildFile section */
+ 826F866D1BF8123D000F9216 /* NSObject+TLYSwizzlingHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 826F865A1BF8123D000F9216 /* NSObject+TLYSwizzlingHelpers.m */; };
+ 826F866E1BF8123D000F9216 /* TLYDelegateProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = 826F865C1BF8123D000F9216 /* TLYDelegateProxy.m */; };
+ 826F866F1BF8123D000F9216 /* UIScrollView+Helpers.m in Sources */ = {isa = PBXBuildFile; fileRef = 826F865E1BF8123D000F9216 /* UIScrollView+Helpers.m */; };
+ 826F86701BF8123D000F9216 /* UIViewController+BetterLayoutGuides.m in Sources */ = {isa = PBXBuildFile; fileRef = 826F86601BF8123D000F9216 /* UIViewController+BetterLayoutGuides.m */; };
+ 826F86711BF8123D000F9216 /* TLYShyScrollViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 826F86651BF8123D000F9216 /* TLYShyScrollViewController.m */; };
+ 826F86721BF8123D000F9216 /* TLYShyStatusBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = 826F86671BF8123D000F9216 /* TLYShyStatusBarController.m */; };
+ 826F86731BF8123D000F9216 /* TLYShyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 826F86691BF8123D000F9216 /* TLYShyViewController.m */; };
+ 826F86741BF8123D000F9216 /* TLYShyNavBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 826F866C1BF8123D000F9216 /* TLYShyNavBarManager.m */; };
E7ADE6101A99A83B00E8F95C /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7ADE60F1A99A83B00E8F95C /* AppDelegate.swift */; };
E7ADE6151A99A83B00E8F95C /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = E7ADE6131A99A83B00E8F95C /* Main.storyboard */; };
E7ADE6171A99A83B00E8F95C /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = E7ADE6161A99A83B00E8F95C /* Images.xcassets */; };
E7ADE61A1A99A83B00E8F95C /* LaunchScreen.xib in Resources */ = {isa = PBXBuildFile; fileRef = E7ADE6181A99A83B00E8F95C /* LaunchScreen.xib */; };
E7ADE6261A99A83B00E8F95C /* TLYShyNavBarSwiftDemoTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7ADE6251A99A83B00E8F95C /* TLYShyNavBarSwiftDemoTests.swift */; };
E7ADE6421A99AB5800E8F95C /* TableViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E7ADE6411A99AB5800E8F95C /* TableViewController.swift */; };
- E7ADE64F1A9A6F7C00E8F95C /* NSObject+TLYSwizzlingHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = E7ADE6461A9A6F7C00E8F95C /* NSObject+TLYSwizzlingHelpers.m */; };
- E7ADE6501A9A6F7C00E8F95C /* UIViewController+BetterLayoutGuides.m in Sources */ = {isa = PBXBuildFile; fileRef = E7ADE6481A9A6F7C00E8F95C /* UIViewController+BetterLayoutGuides.m */; };
- E7ADE6511A9A6F7C00E8F95C /* TLYDelegateProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = E7ADE64A1A9A6F7C00E8F95C /* TLYDelegateProxy.m */; };
- E7ADE6521A9A6F7C00E8F95C /* TLYShyNavBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = E7ADE64C1A9A6F7C00E8F95C /* TLYShyNavBarManager.m */; };
- E7ADE6531A9A6F7C00E8F95C /* TLYShyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = E7ADE64E1A9A6F7C00E8F95C /* TLYShyViewController.m */; };
/* End PBXBuildFile section */
/* Begin PBXContainerItemProxy section */
@@ -31,6 +34,25 @@
/* End PBXContainerItemProxy section */
/* Begin PBXFileReference section */
+ 826F86591BF8123D000F9216 /* NSObject+TLYSwizzlingHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+TLYSwizzlingHelpers.h"; sourceTree = ""; };
+ 826F865A1BF8123D000F9216 /* NSObject+TLYSwizzlingHelpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+TLYSwizzlingHelpers.m"; sourceTree = ""; };
+ 826F865B1BF8123D000F9216 /* TLYDelegateProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYDelegateProxy.h; sourceTree = ""; };
+ 826F865C1BF8123D000F9216 /* TLYDelegateProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLYDelegateProxy.m; sourceTree = ""; };
+ 826F865D1BF8123D000F9216 /* UIScrollView+Helpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIScrollView+Helpers.h"; sourceTree = ""; };
+ 826F865E1BF8123D000F9216 /* UIScrollView+Helpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIScrollView+Helpers.m"; sourceTree = ""; };
+ 826F865F1BF8123D000F9216 /* UIViewController+BetterLayoutGuides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+BetterLayoutGuides.h"; sourceTree = ""; };
+ 826F86601BF8123D000F9216 /* UIViewController+BetterLayoutGuides.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+BetterLayoutGuides.m"; sourceTree = ""; };
+ 826F86621BF8123D000F9216 /* TLYShyChild.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYShyChild.h; sourceTree = ""; };
+ 826F86631BF8123D000F9216 /* TLYShyParent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYShyParent.h; sourceTree = ""; };
+ 826F86641BF8123D000F9216 /* TLYShyScrollViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYShyScrollViewController.h; sourceTree = ""; };
+ 826F86651BF8123D000F9216 /* TLYShyScrollViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLYShyScrollViewController.m; sourceTree = ""; };
+ 826F86661BF8123D000F9216 /* TLYShyStatusBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYShyStatusBarController.h; sourceTree = ""; };
+ 826F86671BF8123D000F9216 /* TLYShyStatusBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLYShyStatusBarController.m; sourceTree = ""; };
+ 826F86681BF8123D000F9216 /* TLYShyViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYShyViewController.h; sourceTree = ""; };
+ 826F86691BF8123D000F9216 /* TLYShyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLYShyViewController.m; sourceTree = ""; };
+ 826F866A1BF8123D000F9216 /* TLYShyNavBarFade.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYShyNavBarFade.h; sourceTree = ""; };
+ 826F866B1BF8123D000F9216 /* TLYShyNavBarManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYShyNavBarManager.h; sourceTree = ""; };
+ 826F866C1BF8123D000F9216 /* TLYShyNavBarManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLYShyNavBarManager.m; sourceTree = ""; };
E7ADE60A1A99A83B00E8F95C /* TLYShyNavBarSwiftDemo.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = TLYShyNavBarSwiftDemo.app; sourceTree = BUILT_PRODUCTS_DIR; };
E7ADE60E1A99A83B00E8F95C /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; };
E7ADE60F1A99A83B00E8F95C /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppDelegate.swift; sourceTree = ""; };
@@ -42,16 +64,6 @@
E7ADE6251A99A83B00E8F95C /* TLYShyNavBarSwiftDemoTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TLYShyNavBarSwiftDemoTests.swift; sourceTree = ""; };
E7ADE6401A99A86600E8F95C /* Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Bridging-Header.h"; sourceTree = ""; };
E7ADE6411A99AB5800E8F95C /* TableViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = TableViewController.swift; sourceTree = ""; };
- E7ADE6451A9A6F7C00E8F95C /* NSObject+TLYSwizzlingHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSObject+TLYSwizzlingHelpers.h"; sourceTree = ""; };
- E7ADE6461A9A6F7C00E8F95C /* NSObject+TLYSwizzlingHelpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSObject+TLYSwizzlingHelpers.m"; sourceTree = ""; };
- E7ADE6471A9A6F7C00E8F95C /* UIViewController+BetterLayoutGuides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIViewController+BetterLayoutGuides.h"; sourceTree = ""; };
- E7ADE6481A9A6F7C00E8F95C /* UIViewController+BetterLayoutGuides.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIViewController+BetterLayoutGuides.m"; sourceTree = ""; };
- E7ADE6491A9A6F7C00E8F95C /* TLYDelegateProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYDelegateProxy.h; sourceTree = ""; };
- E7ADE64A1A9A6F7C00E8F95C /* TLYDelegateProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLYDelegateProxy.m; sourceTree = ""; };
- E7ADE64B1A9A6F7C00E8F95C /* TLYShyNavBarManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYShyNavBarManager.h; sourceTree = ""; };
- E7ADE64C1A9A6F7C00E8F95C /* TLYShyNavBarManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLYShyNavBarManager.m; sourceTree = ""; };
- E7ADE64D1A9A6F7C00E8F95C /* TLYShyViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYShyViewController.h; sourceTree = ""; };
- E7ADE64E1A9A6F7C00E8F95C /* TLYShyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLYShyViewController.m; sourceTree = ""; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@@ -72,11 +84,54 @@
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
+ 826F86571BF8123D000F9216 /* TLYShyNavBar */ = {
+ isa = PBXGroup;
+ children = (
+ 826F86581BF8123D000F9216 /* Categories */,
+ 826F86611BF8123D000F9216 /* ShyControllers */,
+ 826F866A1BF8123D000F9216 /* TLYShyNavBarFade.h */,
+ 826F866B1BF8123D000F9216 /* TLYShyNavBarManager.h */,
+ 826F866C1BF8123D000F9216 /* TLYShyNavBarManager.m */,
+ );
+ name = TLYShyNavBar;
+ path = ../TLYShyNavBar;
+ sourceTree = "";
+ };
+ 826F86581BF8123D000F9216 /* Categories */ = {
+ isa = PBXGroup;
+ children = (
+ 826F86591BF8123D000F9216 /* NSObject+TLYSwizzlingHelpers.h */,
+ 826F865A1BF8123D000F9216 /* NSObject+TLYSwizzlingHelpers.m */,
+ 826F865B1BF8123D000F9216 /* TLYDelegateProxy.h */,
+ 826F865C1BF8123D000F9216 /* TLYDelegateProxy.m */,
+ 826F865D1BF8123D000F9216 /* UIScrollView+Helpers.h */,
+ 826F865E1BF8123D000F9216 /* UIScrollView+Helpers.m */,
+ 826F865F1BF8123D000F9216 /* UIViewController+BetterLayoutGuides.h */,
+ 826F86601BF8123D000F9216 /* UIViewController+BetterLayoutGuides.m */,
+ );
+ path = Categories;
+ sourceTree = "";
+ };
+ 826F86611BF8123D000F9216 /* ShyControllers */ = {
+ isa = PBXGroup;
+ children = (
+ 826F86621BF8123D000F9216 /* TLYShyChild.h */,
+ 826F86631BF8123D000F9216 /* TLYShyParent.h */,
+ 826F86641BF8123D000F9216 /* TLYShyScrollViewController.h */,
+ 826F86651BF8123D000F9216 /* TLYShyScrollViewController.m */,
+ 826F86661BF8123D000F9216 /* TLYShyStatusBarController.h */,
+ 826F86671BF8123D000F9216 /* TLYShyStatusBarController.m */,
+ 826F86681BF8123D000F9216 /* TLYShyViewController.h */,
+ 826F86691BF8123D000F9216 /* TLYShyViewController.m */,
+ );
+ path = ShyControllers;
+ sourceTree = "";
+ };
E7ADE6011A99A83B00E8F95C = {
isa = PBXGroup;
children = (
E7ADE6401A99A86600E8F95C /* Bridging-Header.h */,
- E7ADE6431A9A6F7C00E8F95C /* TLYShyNavBar */,
+ 826F86571BF8123D000F9216 /* TLYShyNavBar */,
E7ADE60C1A99A83B00E8F95C /* TLYShyNavBarSwiftDemo */,
E7ADE6221A99A83B00E8F95C /* TLYShyNavBarSwiftDemoTests */,
E7ADE60B1A99A83B00E8F95C /* Products */,
@@ -130,32 +185,6 @@
name = "Supporting Files";
sourceTree = "";
};
- E7ADE6431A9A6F7C00E8F95C /* TLYShyNavBar */ = {
- isa = PBXGroup;
- children = (
- E7ADE6441A9A6F7C00E8F95C /* Categories */,
- E7ADE6491A9A6F7C00E8F95C /* TLYDelegateProxy.h */,
- E7ADE64A1A9A6F7C00E8F95C /* TLYDelegateProxy.m */,
- E7ADE64B1A9A6F7C00E8F95C /* TLYShyNavBarManager.h */,
- E7ADE64C1A9A6F7C00E8F95C /* TLYShyNavBarManager.m */,
- E7ADE64D1A9A6F7C00E8F95C /* TLYShyViewController.h */,
- E7ADE64E1A9A6F7C00E8F95C /* TLYShyViewController.m */,
- );
- name = TLYShyNavBar;
- path = ../TLYShyNavBar;
- sourceTree = "";
- };
- E7ADE6441A9A6F7C00E8F95C /* Categories */ = {
- isa = PBXGroup;
- children = (
- E7ADE6451A9A6F7C00E8F95C /* NSObject+TLYSwizzlingHelpers.h */,
- E7ADE6461A9A6F7C00E8F95C /* NSObject+TLYSwizzlingHelpers.m */,
- E7ADE6471A9A6F7C00E8F95C /* UIViewController+BetterLayoutGuides.h */,
- E7ADE6481A9A6F7C00E8F95C /* UIViewController+BetterLayoutGuides.m */,
- );
- path = Categories;
- sourceTree = "";
- };
/* End PBXGroup section */
/* Begin PBXNativeTarget section */
@@ -200,7 +229,8 @@
E7ADE6021A99A83B00E8F95C /* Project object */ = {
isa = PBXProject;
attributes = {
- LastUpgradeCheck = 0610;
+ LastSwiftUpdateCheck = 0710;
+ LastUpgradeCheck = 0710;
ORGANIZATIONNAME = "Acktie, LLC";
TargetAttributes = {
E7ADE6091A99A83B00E8F95C = {
@@ -256,13 +286,16 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
- E7ADE6531A9A6F7C00E8F95C /* TLYShyViewController.m in Sources */,
+ 826F86741BF8123D000F9216 /* TLYShyNavBarManager.m in Sources */,
+ 826F86731BF8123D000F9216 /* TLYShyViewController.m in Sources */,
+ 826F86721BF8123D000F9216 /* TLYShyStatusBarController.m in Sources */,
E7ADE6421A99AB5800E8F95C /* TableViewController.swift in Sources */,
- E7ADE6501A9A6F7C00E8F95C /* UIViewController+BetterLayoutGuides.m in Sources */,
+ 826F86711BF8123D000F9216 /* TLYShyScrollViewController.m in Sources */,
+ 826F86701BF8123D000F9216 /* UIViewController+BetterLayoutGuides.m in Sources */,
E7ADE6101A99A83B00E8F95C /* AppDelegate.swift in Sources */,
- E7ADE6511A9A6F7C00E8F95C /* TLYDelegateProxy.m in Sources */,
- E7ADE6521A9A6F7C00E8F95C /* TLYShyNavBarManager.m in Sources */,
- E7ADE64F1A9A6F7C00E8F95C /* NSObject+TLYSwizzlingHelpers.m in Sources */,
+ 826F866D1BF8123D000F9216 /* NSObject+TLYSwizzlingHelpers.m in Sources */,
+ 826F866E1BF8123D000F9216 /* TLYDelegateProxy.m in Sources */,
+ 826F866F1BF8123D000F9216 /* UIScrollView+Helpers.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -324,6 +357,7 @@
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
+ ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
@@ -387,6 +421,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = TLYShyNavBarSwiftDemo/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.telly.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Bridging-Header.h";
};
@@ -398,6 +433,7 @@
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
INFOPLIST_FILE = TLYShyNavBarSwiftDemo/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.telly.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
SWIFT_OBJC_BRIDGING_HEADER = "Bridging-Header.h";
};
@@ -417,6 +453,7 @@
);
INFOPLIST_FILE = TLYShyNavBarSwiftDemoTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.telly.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TLYShyNavBarSwiftDemo.app/TLYShyNavBarSwiftDemo";
};
@@ -432,6 +469,7 @@
);
INFOPLIST_FILE = TLYShyNavBarSwiftDemoTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
+ PRODUCT_BUNDLE_IDENTIFIER = "com.telly.$(PRODUCT_NAME:rfc1034identifier)";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUILT_PRODUCTS_DIR)/TLYShyNavBarSwiftDemo.app/TLYShyNavBarSwiftDemo";
};
diff --git a/TLYShyNavBarSwiftDemo/TLYShyNavBarSwiftDemo/AppDelegate.swift b/TLYShyNavBarSwiftDemo/TLYShyNavBarSwiftDemo/AppDelegate.swift
index 74bdc5b..170a806 100644
--- a/TLYShyNavBarSwiftDemo/TLYShyNavBarSwiftDemo/AppDelegate.swift
+++ b/TLYShyNavBarSwiftDemo/TLYShyNavBarSwiftDemo/AppDelegate.swift
@@ -3,7 +3,7 @@
// TLYShyNavBarSwiftDemo
//
// Created by Tony Nuzzi on 2/22/15.
-// Copyright (c) 2015 Acktie, LLC. All rights reserved.
+// Copyright (c) 2015 Telly, Inc. All rights reserved.
//
import UIKit
@@ -15,9 +15,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate {
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
- // Override point for customization after application launch.
return true
}
-
}
diff --git a/TLYShyNavBarSwiftDemo/TLYShyNavBarSwiftDemo/Base.lproj/LaunchScreen.xib b/TLYShyNavBarSwiftDemo/TLYShyNavBarSwiftDemo/Base.lproj/LaunchScreen.xib
index b2fc1c2..d23d7a8 100644
--- a/TLYShyNavBarSwiftDemo/TLYShyNavBarSwiftDemo/Base.lproj/LaunchScreen.xib
+++ b/TLYShyNavBarSwiftDemo/TLYShyNavBarSwiftDemo/Base.lproj/LaunchScreen.xib
@@ -1,7 +1,8 @@
-
+
-
+
+
@@ -11,12 +12,6 @@
-