Compare commits

...

40 Commits

Author SHA1 Message Date
Alexey Savin bba3fcecc4 Contacted, expanded properties exposed 2016-04-19 14:13:57 +03:00
Alexey Savin 31dbd543ad Added expand completion 2016-03-16 20:17:20 +03:00
Alexey Savin b7beb2f8c8 Hidden status bar height fix 2016-03-16 20:01:16 +03:00
Alexey Savin e2bce07b36 Minor fix 2016-03-16 19:55:49 +03:00
Alexey Savin a24bd2f297 Minor fix 2016-03-16 19:50:10 +03:00
Alexey Savin 1bf3376157 Status bar additional handling 2016-03-16 19:39:45 +03:00
Alexey Savin 3ef37fc24f Minor fix 2016-03-16 17:05:23 +03:00
Alexey Savin 3ad2556f55 Expand method
Delegate fix
2016-03-16 16:54:20 +03:00
Maz Jaleel 537bce6c30 Merge pull request #122 from szweier/fix-refresh
Fix refresh
2016-02-29 23:07:44 +09:00
Maz Jaleel 6cd994afa7 Merge pull request #123 from szweier/fix-navigation-controller-is-jumping-unexpectedly
Fix constraints to make demo work correctly
2016-02-24 09:05:24 +09:00
Steven Zweier a117fc058f fix default values 2016-02-23 11:31:32 -05:00
Steven Zweier 39302de4ba Fix constraints to make demo work correctly 2016-02-23 11:21:56 -05:00
Steven Zweier 48b0eafe5f add line break 2016-02-23 09:52:50 -05:00
Steven Zweier 3a138c4207 add line break 2016-02-23 09:51:32 -05:00
Steven Zweier 58a2d1b31c adjust alignment 2016-02-23 09:50:29 -05:00
Steven Zweier c41c5bd3ad fix refresh issue 2016-02-23 09:49:40 -05:00
Maz Jaleel d16780e8a5 Merge pull request #121 from szweier/set-specific-viewcontroller-on-manager
Allow specific view controller to be set if needed
2016-02-23 22:41:31 +09:00
Steven Zweier 15bd513774 Fix refresh control 2016-02-22 16:33:09 -05:00
Steven Zweier 192075bf3d Allow specific view controller to be set if needed 2016-02-22 14:02:29 -05:00
Maz Jaleel b0eacc80bf Merge pull request #118 from gfzabarino/feature/queryForAssociationToViewController
Added method to query if a TLYShyNavBarManager instance is associated with a UIViewController without triggering its creation
2016-01-30 22:43:10 +09:00
Maz Jaleel a1c57da65f Merge pull request #117 from gfzabarino/master
Scroll view started with wrong content offset on some occasions
2016-01-30 20:14:56 +09:00
Gian Franco Zabarino 47f9b081bf - Added method to query for the existence of an associated TLYShyNavBarManager instance without triggering its creation and association. 2016-01-29 23:17:28 -03:00
Maz Jaleel fb95964272 Merge pull request #114 from bbreier/master
Fix issue #113
2016-01-30 10:22:07 +09:00
Gian Franco Zabarino b8b32c597f Merge branch 'upstreamMaster' 2016-01-29 22:04:59 -03:00
Gian Franco Zabarino e1fba0efa7 - Fixed bug in which the bounds / contentOffset of the scroll view wasn't being updated on some occasions. 2016-01-29 22:04:14 -03:00
Benjamin Breier 2bca45f16d Fix bug that could alter frame of UICollectionViews on first hiding of nav bar 2016-01-15 17:21:14 -08:00
Maz Jaleel fa4b25e4bf Merge pull request #106 from gfzabarino/master
Added delegate to TLYShyNavBarManager
2015-12-20 23:01:05 -08:00
Gian Franco Zabarino fc2108e238 Changed typeof statement to __typeof. 2015-12-21 01:28:59 -03:00
Gian Franco Zabarino 71f03b9195 Added delegate to latest code in the original repository. 2015-12-11 18:13:43 -03:00
Gian Franco Zabarino 53cf176916 Merge remote-tracking branch 'upstream/master'
# Conflicts:
#	TLYShyNavBar/TLYShyNavBarManager.h
#	TLYShyNavBar/TLYShyNavBarManager.m
2015-12-11 18:08:05 -03:00
Maz Jaleel 7e52e3a427 Update README.md
better shield link
2015-11-22 23:07:41 -08:00
Maz Jaleel a4d91870aa Update README.md 2015-11-19 02:20:42 -08:00
Maz Jaleel 07ac754965 Update README.md 2015-11-19 02:17:54 -08:00
Maz Jaleel 70a1ff03c6 Merge pull request #98 from bradleyayers/master
Add support for carthage
2015-11-19 02:17:00 -08:00
Bradley Ayers 8f40de0fc0 Update README to include Carthage instructions 2015-11-19 21:10:52 +11:00
Bradley Ayers 03427bccbe #73 Share the default TLYShyNavBar scheme so it is built by carthage. 2015-11-19 21:02:38 +11:00
Bradley Ayers 4484d0747a Add an xcodeproj for #73. 2015-11-19 20:58:03 +11:00
Gian Franco Zabarino 983f632b76 Added delegate method to notify the client when the navigation bar became fully contracted. 2015-05-05 16:59:57 -03:00
Gian Franco Zabarino 2e065ac823 Added delegate to have the client notified when a contraction or expansion finishes animating. 2015-05-05 16:41:04 -03:00
Gian Franco Zabarino d975745250 Added scrollIndicatorInsets adjust when scrolling. 2015-05-04 20:43:44 -03:00
15 changed files with 768 additions and 76 deletions

View File

@ -3,8 +3,9 @@
__v1.0, Finally! With better code design, and fully featured!__
-----
![Pod Version](https://cocoapod-badges.herokuapp.com/v/TLYShyNavBar/badge.png)
![Pod Version](https://img.shields.io/cocoapods/v/TLYShyNavBar.svg)
![Pod License](https://img.shields.io/badge/license-MIT-blue.svg)
[![Carthage compatible](https://img.shields.io/badge/Carthage-compatible-4BC51D.svg?style=flat)](https://github.com/Carthage/Carthage)
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)<sup>[1]</sup>!
@ -51,6 +52,9 @@ You can test some of these features in the Objective-C demo:
Add the following to you [Podfile](http://guides.cocoapods.org/using/the-podfile.html) `pod 'TLYShyNavBar'`<br />
Import the header `#import <TLYShyNavBar/TLYShyNavBarManager.h>`
+ Using [Carthage](https://github.com/Carthage/Carthage) (Thanks [@bradleyayers](https://github.com/bradleyayers)!):<br />
Add the following to your [Cartfile](https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md) `github "telly/TLYShyNavBar"`<br />
Import the header `#import <TLYShyNavBar/TLYShyNavBar.h>`
+ Using Submodules:<br />
Download the project/git submodules, and drag the `TLYShyNavBar` folder to your project. <br />

View File

@ -0,0 +1,386 @@
// !$*UTF8*$!
{
archiveVersion = 1;
classes = {
};
objectVersion = 46;
objects = {
/* Begin PBXBuildFile section */
A21B00001BFDD41100F9FB54 /* TLYShyScrollViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A21BFFF81BFDD41100F9FB54 /* TLYShyScrollViewController.m */; };
A21B00011BFDD41100F9FB54 /* TLYShyStatusBarController.h in Headers */ = {isa = PBXBuildFile; fileRef = A21BFFF91BFDD41100F9FB54 /* TLYShyStatusBarController.h */; };
A21B00021BFDD41100F9FB54 /* TLYShyStatusBarController.m in Sources */ = {isa = PBXBuildFile; fileRef = A21BFFFA1BFDD41100F9FB54 /* TLYShyStatusBarController.m */; };
A21B00031BFDD41100F9FB54 /* TLYShyViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = A21BFFFB1BFDD41100F9FB54 /* TLYShyViewController.h */; };
A21B00041BFDD41100F9FB54 /* TLYShyViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = A21BFFFC1BFDD41100F9FB54 /* TLYShyViewController.m */; };
A21B00081BFDD41900F9FB54 /* TLYShyNavBarFade.h in Headers */ = {isa = PBXBuildFile; fileRef = A21B00051BFDD41900F9FB54 /* TLYShyNavBarFade.h */; settings = {ATTRIBUTES = (Public, ); }; };
A21B00091BFDD41900F9FB54 /* TLYShyNavBarManager.h in Headers */ = {isa = PBXBuildFile; fileRef = A21B00061BFDD41900F9FB54 /* TLYShyNavBarManager.h */; settings = {ATTRIBUTES = (Public, ); }; };
A21B000A1BFDD41900F9FB54 /* TLYShyNavBarManager.m in Sources */ = {isa = PBXBuildFile; fileRef = A21B00071BFDD41900F9FB54 /* TLYShyNavBarManager.m */; };
A21BFFA71BFDCC8800F9FB54 /* TLYShyNavBar.h in Headers */ = {isa = PBXBuildFile; fileRef = A21BFFA61BFDCC8800F9FB54 /* TLYShyNavBar.h */; settings = {ATTRIBUTES = (Public, ); }; };
A21BFFED1BFDD40800F9FB54 /* NSObject+TLYSwizzlingHelpers.h in Headers */ = {isa = PBXBuildFile; fileRef = A21BFFE51BFDD40800F9FB54 /* NSObject+TLYSwizzlingHelpers.h */; };
A21BFFEE1BFDD40800F9FB54 /* NSObject+TLYSwizzlingHelpers.m in Sources */ = {isa = PBXBuildFile; fileRef = A21BFFE61BFDD40800F9FB54 /* NSObject+TLYSwizzlingHelpers.m */; };
A21BFFEF1BFDD40800F9FB54 /* TLYDelegateProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = A21BFFE71BFDD40800F9FB54 /* TLYDelegateProxy.h */; };
A21BFFF01BFDD40800F9FB54 /* TLYDelegateProxy.m in Sources */ = {isa = PBXBuildFile; fileRef = A21BFFE81BFDD40800F9FB54 /* TLYDelegateProxy.m */; };
A21BFFF11BFDD40800F9FB54 /* UIScrollView+Helpers.h in Headers */ = {isa = PBXBuildFile; fileRef = A21BFFE91BFDD40800F9FB54 /* UIScrollView+Helpers.h */; };
A21BFFF21BFDD40800F9FB54 /* UIScrollView+Helpers.m in Sources */ = {isa = PBXBuildFile; fileRef = A21BFFEA1BFDD40800F9FB54 /* UIScrollView+Helpers.m */; };
A21BFFF31BFDD40800F9FB54 /* UIViewController+BetterLayoutGuides.h in Headers */ = {isa = PBXBuildFile; fileRef = A21BFFEB1BFDD40800F9FB54 /* UIViewController+BetterLayoutGuides.h */; };
A21BFFF41BFDD40800F9FB54 /* UIViewController+BetterLayoutGuides.m in Sources */ = {isa = PBXBuildFile; fileRef = A21BFFEC1BFDD40800F9FB54 /* UIViewController+BetterLayoutGuides.m */; };
A21BFFFD1BFDD41100F9FB54 /* TLYShyChild.h in Headers */ = {isa = PBXBuildFile; fileRef = A21BFFF51BFDD41100F9FB54 /* TLYShyChild.h */; };
A21BFFFE1BFDD41100F9FB54 /* TLYShyParent.h in Headers */ = {isa = PBXBuildFile; fileRef = A21BFFF61BFDD41100F9FB54 /* TLYShyParent.h */; };
A21BFFFF1BFDD41100F9FB54 /* TLYShyScrollViewController.h in Headers */ = {isa = PBXBuildFile; fileRef = A21BFFF71BFDD41100F9FB54 /* TLYShyScrollViewController.h */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
A21B00051BFDD41900F9FB54 /* TLYShyNavBarFade.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYShyNavBarFade.h; sourceTree = "<group>"; };
A21B00061BFDD41900F9FB54 /* TLYShyNavBarManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TLYShyNavBarManager.h; sourceTree = "<group>"; };
A21B00071BFDD41900F9FB54 /* TLYShyNavBarManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TLYShyNavBarManager.m; sourceTree = "<group>"; };
A21BFFA41BFDCC8800F9FB54 /* TLYShyNavBar.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = TLYShyNavBar.framework; sourceTree = BUILT_PRODUCTS_DIR; };
A21BFFA61BFDCC8800F9FB54 /* TLYShyNavBar.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = TLYShyNavBar.h; sourceTree = "<group>"; };
A21BFFA81BFDCC8800F9FB54 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
A21BFFE51BFDD40800F9FB54 /* NSObject+TLYSwizzlingHelpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "NSObject+TLYSwizzlingHelpers.h"; path = "Categories/NSObject+TLYSwizzlingHelpers.h"; sourceTree = "<group>"; };
A21BFFE61BFDD40800F9FB54 /* NSObject+TLYSwizzlingHelpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "NSObject+TLYSwizzlingHelpers.m"; path = "Categories/NSObject+TLYSwizzlingHelpers.m"; sourceTree = "<group>"; };
A21BFFE71BFDD40800F9FB54 /* TLYDelegateProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TLYDelegateProxy.h; path = Categories/TLYDelegateProxy.h; sourceTree = "<group>"; };
A21BFFE81BFDD40800F9FB54 /* TLYDelegateProxy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TLYDelegateProxy.m; path = Categories/TLYDelegateProxy.m; sourceTree = "<group>"; };
A21BFFE91BFDD40800F9FB54 /* UIScrollView+Helpers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIScrollView+Helpers.h"; path = "Categories/UIScrollView+Helpers.h"; sourceTree = "<group>"; };
A21BFFEA1BFDD40800F9FB54 /* UIScrollView+Helpers.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIScrollView+Helpers.m"; path = "Categories/UIScrollView+Helpers.m"; sourceTree = "<group>"; };
A21BFFEB1BFDD40800F9FB54 /* UIViewController+BetterLayoutGuides.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "UIViewController+BetterLayoutGuides.h"; path = "Categories/UIViewController+BetterLayoutGuides.h"; sourceTree = "<group>"; };
A21BFFEC1BFDD40800F9FB54 /* UIViewController+BetterLayoutGuides.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = "UIViewController+BetterLayoutGuides.m"; path = "Categories/UIViewController+BetterLayoutGuides.m"; sourceTree = "<group>"; };
A21BFFF51BFDD41100F9FB54 /* TLYShyChild.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TLYShyChild.h; path = ShyControllers/TLYShyChild.h; sourceTree = "<group>"; };
A21BFFF61BFDD41100F9FB54 /* TLYShyParent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TLYShyParent.h; path = ShyControllers/TLYShyParent.h; sourceTree = "<group>"; };
A21BFFF71BFDD41100F9FB54 /* TLYShyScrollViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TLYShyScrollViewController.h; path = ShyControllers/TLYShyScrollViewController.h; sourceTree = "<group>"; };
A21BFFF81BFDD41100F9FB54 /* TLYShyScrollViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TLYShyScrollViewController.m; path = ShyControllers/TLYShyScrollViewController.m; sourceTree = "<group>"; };
A21BFFF91BFDD41100F9FB54 /* TLYShyStatusBarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TLYShyStatusBarController.h; path = ShyControllers/TLYShyStatusBarController.h; sourceTree = "<group>"; };
A21BFFFA1BFDD41100F9FB54 /* TLYShyStatusBarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TLYShyStatusBarController.m; path = ShyControllers/TLYShyStatusBarController.m; sourceTree = "<group>"; };
A21BFFFB1BFDD41100F9FB54 /* TLYShyViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TLYShyViewController.h; path = ShyControllers/TLYShyViewController.h; sourceTree = "<group>"; };
A21BFFFC1BFDD41100F9FB54 /* TLYShyViewController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = TLYShyViewController.m; path = ShyControllers/TLYShyViewController.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
A21BFFA01BFDCC8800F9FB54 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXFrameworksBuildPhase section */
/* Begin PBXGroup section */
A21BFF711BFDCB3E00F9FB54 = {
isa = PBXGroup;
children = (
A21BFFAC1BFDCCE000F9FB54 /* Products */,
A21BFFA51BFDCC8800F9FB54 /* TLYShyNavBar */,
);
sourceTree = "<group>";
};
A21BFFA51BFDCC8800F9FB54 /* TLYShyNavBar */ = {
isa = PBXGroup;
children = (
A21B00051BFDD41900F9FB54 /* TLYShyNavBarFade.h */,
A21B00061BFDD41900F9FB54 /* TLYShyNavBarManager.h */,
A21B00071BFDD41900F9FB54 /* TLYShyNavBarManager.m */,
A21BFFDE1BFDD1A500F9FB54 /* Categories */,
A21BFFCD1BFDD18D00F9FB54 /* ShyControllers */,
A21BFFA61BFDCC8800F9FB54 /* TLYShyNavBar.h */,
A21BFFAD1BFDCD5100F9FB54 /* Supporting Files */,
);
path = TLYShyNavBar;
sourceTree = "<group>";
};
A21BFFAC1BFDCCE000F9FB54 /* Products */ = {
isa = PBXGroup;
children = (
A21BFFA41BFDCC8800F9FB54 /* TLYShyNavBar.framework */,
);
name = Products;
sourceTree = "<group>";
};
A21BFFAD1BFDCD5100F9FB54 /* Supporting Files */ = {
isa = PBXGroup;
children = (
A21BFFA81BFDCC8800F9FB54 /* Info.plist */,
);
name = "Supporting Files";
sourceTree = "<group>";
};
A21BFFCD1BFDD18D00F9FB54 /* ShyControllers */ = {
isa = PBXGroup;
children = (
A21BFFF51BFDD41100F9FB54 /* TLYShyChild.h */,
A21BFFF61BFDD41100F9FB54 /* TLYShyParent.h */,
A21BFFF71BFDD41100F9FB54 /* TLYShyScrollViewController.h */,
A21BFFF81BFDD41100F9FB54 /* TLYShyScrollViewController.m */,
A21BFFF91BFDD41100F9FB54 /* TLYShyStatusBarController.h */,
A21BFFFA1BFDD41100F9FB54 /* TLYShyStatusBarController.m */,
A21BFFFB1BFDD41100F9FB54 /* TLYShyViewController.h */,
A21BFFFC1BFDD41100F9FB54 /* TLYShyViewController.m */,
);
name = ShyControllers;
sourceTree = "<group>";
};
A21BFFDE1BFDD1A500F9FB54 /* Categories */ = {
isa = PBXGroup;
children = (
A21BFFE51BFDD40800F9FB54 /* NSObject+TLYSwizzlingHelpers.h */,
A21BFFE61BFDD40800F9FB54 /* NSObject+TLYSwizzlingHelpers.m */,
A21BFFE71BFDD40800F9FB54 /* TLYDelegateProxy.h */,
A21BFFE81BFDD40800F9FB54 /* TLYDelegateProxy.m */,
A21BFFE91BFDD40800F9FB54 /* UIScrollView+Helpers.h */,
A21BFFEA1BFDD40800F9FB54 /* UIScrollView+Helpers.m */,
A21BFFEB1BFDD40800F9FB54 /* UIViewController+BetterLayoutGuides.h */,
A21BFFEC1BFDD40800F9FB54 /* UIViewController+BetterLayoutGuides.m */,
);
name = Categories;
sourceTree = "<group>";
};
/* End PBXGroup section */
/* Begin PBXHeadersBuildPhase section */
A21BFFA11BFDCC8800F9FB54 /* Headers */ = {
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
A21BFFED1BFDD40800F9FB54 /* NSObject+TLYSwizzlingHelpers.h in Headers */,
A21B00091BFDD41900F9FB54 /* TLYShyNavBarManager.h in Headers */,
A21B00081BFDD41900F9FB54 /* TLYShyNavBarFade.h in Headers */,
A21B00011BFDD41100F9FB54 /* TLYShyStatusBarController.h in Headers */,
A21BFFF31BFDD40800F9FB54 /* UIViewController+BetterLayoutGuides.h in Headers */,
A21BFFFD1BFDD41100F9FB54 /* TLYShyChild.h in Headers */,
A21BFFEF1BFDD40800F9FB54 /* TLYDelegateProxy.h in Headers */,
A21BFFF11BFDD40800F9FB54 /* UIScrollView+Helpers.h in Headers */,
A21B00031BFDD41100F9FB54 /* TLYShyViewController.h in Headers */,
A21BFFFF1BFDD41100F9FB54 /* TLYShyScrollViewController.h in Headers */,
A21BFFA71BFDCC8800F9FB54 /* TLYShyNavBar.h in Headers */,
A21BFFFE1BFDD41100F9FB54 /* TLYShyParent.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXHeadersBuildPhase section */
/* Begin PBXNativeTarget section */
A21BFFA31BFDCC8800F9FB54 /* TLYShyNavBar */ = {
isa = PBXNativeTarget;
buildConfigurationList = A21BFFA91BFDCC8800F9FB54 /* Build configuration list for PBXNativeTarget "TLYShyNavBar" */;
buildPhases = (
A21BFF9F1BFDCC8800F9FB54 /* Sources */,
A21BFFA01BFDCC8800F9FB54 /* Frameworks */,
A21BFFA11BFDCC8800F9FB54 /* Headers */,
A21BFFA21BFDCC8800F9FB54 /* Resources */,
);
buildRules = (
);
dependencies = (
);
name = TLYShyNavBar;
productName = TLYShyNavBar;
productReference = A21BFFA41BFDCC8800F9FB54 /* TLYShyNavBar.framework */;
productType = "com.apple.product-type.framework";
};
/* End PBXNativeTarget section */
/* Begin PBXProject section */
A21BFF721BFDCB3E00F9FB54 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0710;
TargetAttributes = {
A21BFFA31BFDCC8800F9FB54 = {
CreatedOnToolsVersion = 7.1.1;
};
};
};
buildConfigurationList = A21BFF751BFDCB3E00F9FB54 /* Build configuration list for PBXProject "TLYShyNavBar" */;
compatibilityVersion = "Xcode 3.2";
developmentRegion = English;
hasScannedForEncodings = 0;
knownRegions = (
en,
);
mainGroup = A21BFF711BFDCB3E00F9FB54;
productRefGroup = A21BFF711BFDCB3E00F9FB54;
projectDirPath = "";
projectRoot = "";
targets = (
A21BFFA31BFDCC8800F9FB54 /* TLYShyNavBar */,
);
};
/* End PBXProject section */
/* Begin PBXResourcesBuildPhase section */
A21BFFA21BFDCC8800F9FB54 /* Resources */ = {
isa = PBXResourcesBuildPhase;
buildActionMask = 2147483647;
files = (
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXResourcesBuildPhase section */
/* Begin PBXSourcesBuildPhase section */
A21BFF9F1BFDCC8800F9FB54 /* Sources */ = {
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
A21B00041BFDD41100F9FB54 /* TLYShyViewController.m in Sources */,
A21BFFF21BFDD40800F9FB54 /* UIScrollView+Helpers.m in Sources */,
A21B000A1BFDD41900F9FB54 /* TLYShyNavBarManager.m in Sources */,
A21BFFF41BFDD40800F9FB54 /* UIViewController+BetterLayoutGuides.m in Sources */,
A21BFFEE1BFDD40800F9FB54 /* NSObject+TLYSwizzlingHelpers.m in Sources */,
A21BFFF01BFDD40800F9FB54 /* TLYDelegateProxy.m in Sources */,
A21B00021BFDD41100F9FB54 /* TLYShyStatusBarController.m in Sources */,
A21B00001BFDD41100F9FB54 /* TLYShyScrollViewController.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
/* End PBXSourcesBuildPhase section */
/* Begin XCBuildConfiguration section */
A21BFF8D1BFDCB3E00F9FB54 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = dwarf;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"$(inherited)",
);
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
MTL_ENABLE_DEBUG_INFO = YES;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Debug;
};
A21BFF8E1BFDCB3E00F9FB54 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_MODULES = YES;
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
CURRENT_PROJECT_VERSION = 1;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
ENABLE_NS_ASSERTIONS = NO;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
IPHONEOS_DEPLOYMENT_TARGET = 9.1;
MTL_ENABLE_DEBUG_INFO = NO;
SDKROOT = iphoneos;
TARGETED_DEVICE_FAMILY = "1,2";
VALIDATE_PRODUCT = YES;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
name = Release;
};
A21BFFAA1BFDCC8800F9FB54 /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CURRENT_PROJECT_VERSION = 1.0.0;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = TLYShyNavBar/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.telly.TLYShyNavBar;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Debug;
};
A21BFFAB1BFDCC8800F9FB54 /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CURRENT_PROJECT_VERSION = 1.0.0;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
DYLIB_INSTALL_NAME_BASE = "@rpath";
INFOPLIST_FILE = TLYShyNavBar/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
IPHONEOS_DEPLOYMENT_TARGET = 8.0;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.telly.TLYShyNavBar;
PRODUCT_NAME = "$(TARGET_NAME)";
SKIP_INSTALL = YES;
};
name = Release;
};
/* End XCBuildConfiguration section */
/* Begin XCConfigurationList section */
A21BFF751BFDCB3E00F9FB54 /* Build configuration list for PBXProject "TLYShyNavBar" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A21BFF8D1BFDCB3E00F9FB54 /* Debug */,
A21BFF8E1BFDCB3E00F9FB54 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
A21BFFA91BFDCC8800F9FB54 /* Build configuration list for PBXNativeTarget "TLYShyNavBar" */ = {
isa = XCConfigurationList;
buildConfigurations = (
A21BFFAA1BFDCC8800F9FB54 /* Debug */,
A21BFFAB1BFDCC8800F9FB54 /* Release */,
);
defaultConfigurationIsVisible = 0;
defaultConfigurationName = Release;
};
/* End XCConfigurationList section */
};
rootObject = A21BFF721BFDCB3E00F9FB54 /* Project object */;
}

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:TLYShyNavBar.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,99 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "0710"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A21BFFA31BFDCC8800F9FB54"
BuildableName = "TLYShyNavBar.framework"
BlueprintName = "TLYShyNavBar"
ReferencedContainer = "container:TLYShyNavBar.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A21BFF841BFDCB3E00F9FB54"
BuildableName = "TLYShyNavBarTests.xctest"
BlueprintName = "TLYShyNavBarTests"
ReferencedContainer = "container:TLYShyNavBar.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A21BFFA31BFDCC8800F9FB54"
BuildableName = "TLYShyNavBar.framework"
BlueprintName = "TLYShyNavBar"
ReferencedContainer = "container:TLYShyNavBar.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A21BFFA31BFDCC8800F9FB54"
BuildableName = "TLYShyNavBar.framework"
BlueprintName = "TLYShyNavBar"
ReferencedContainer = "container:TLYShyNavBar.xcodeproj">
</BuildableReference>
</MacroExpansion>
<AdditionalOptions>
</AdditionalOptions>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "A21BFFA31BFDCC8800F9FB54"
BuildableName = "TLYShyNavBar.framework"
BlueprintName = "TLYShyNavBar"
ReferencedContainer = "container:TLYShyNavBar.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

View File

@ -11,6 +11,6 @@
@interface UIScrollView (Helpers)
- (void)tly_setInsets:(UIEdgeInsets)contentInsets preserveOffset:(BOOL)preserveOffset;
- (void)tly_setInsets:(UIEdgeInsets)contentInsets;
@end

View File

@ -11,9 +11,9 @@
@implementation UIScrollView (Helpers)
// Modify contentInset and scrollIndicatorInsets
- (void)tly_setInsets:(UIEdgeInsets)contentInsets preserveOffset:(BOOL)preserveOffset
- (void)tly_setInsets:(UIEdgeInsets)contentInsets
{
if (preserveOffset && contentInsets.top != self.contentInset.top)
if (!self.isDragging && !self.isDecelerating && contentInsets.top != self.contentInset.top)
{
CGFloat offsetDelta = contentInsets.top - self.contentInset.top;

26
TLYShyNavBar/Info.plist Normal file
View File

@ -0,0 +1,26 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

View File

@ -15,8 +15,9 @@
@interface TLYShyScrollViewController : NSObject <TLYShyChild>
@property (nonatomic, weak) UIScrollView *scrollView;
@property (nonatomic, weak) UIRefreshControl *refreshControl;
@property (nonatomic, weak) TLYShyViewController *parent;
- (CGFloat)updateLayoutIfNeeded:(BOOL)intelligently;
- (CGFloat)updateLayoutIfNeeded;
@end

View File

@ -14,10 +14,10 @@
- (void)offsetCenterBy:(CGPoint)deltaPoint
{
[self updateLayoutIfNeeded:NO];
[self updateLayoutIfNeeded];
}
- (CGFloat)updateLayoutIfNeeded:(BOOL)intelligently
- (CGFloat)updateLayoutIfNeeded
{
if (self.scrollView.contentSize.height < FLT_EPSILON
&& ([self.scrollView isKindOfClass:[UITableView class]]
@ -26,29 +26,32 @@
{
return 0.f;
}
CGFloat parentMaxY = [self.parent maxYRelativeToView:self.scrollView.superview];
CGFloat normalizedY = parentMaxY - self.scrollView.frame.origin.y;
UIEdgeInsets insets = self.scrollView.contentInset;
UIEdgeInsets insets = UIEdgeInsetsMake(self.scrollView.contentInset.top, 0, self.scrollView.contentInset.bottom, 0);
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];
if (self.refreshControl == nil || [self.refreshControl isHidden]) {
[self.scrollView tly_setInsets:insets];
}
return delta;
}
if (normalizedY < -FLT_EPSILON)
{
{
CGRect frame = self.scrollView.frame;
frame = UIEdgeInsetsInsetRect(frame, insets);
self.scrollView.frame = frame;
return [self updateLayoutIfNeeded:YES];
return [self updateLayoutIfNeeded];
}
return 0.f;
}

View File

@ -37,16 +37,21 @@ typedef CGFloat(^TLYShyViewControllerContractionAmountBlock)(UIView *view);
@property (nonatomic, weak) TLYShyViewController *subShyController;
@property (nonatomic, weak) UIView *view;
@property (nonatomic, assign, readonly) BOOL contracted;
@property (nonatomic, assign, readonly) BOOL expanded;
@property (nonatomic) TLYShyNavBarFade fadeBehavior;
/* Sticky means it will always stay in expanded state
*/
@property (nonatomic) BOOL sticky;
@property (nonatomic) BOOL handleStatusBar;
- (void)offsetCenterBy:(CGPoint)deltaPoint;
- (CGFloat)updateYOffset:(CGFloat)deltaY;
- (CGFloat)snap:(BOOL)contract;
- (CGFloat)snap:(BOOL)contract completion:(void (^)())completion;
- (CGFloat)expand;
- (CGFloat)contract;

View File

@ -8,7 +8,6 @@
#import "TLYShyViewController.h"
@implementation TLYShyViewController (AsParent)
- (CGFloat)maxYRelativeToView:(UIView *)superview
@ -26,6 +25,7 @@
@end
static CGFloat const kTLYShyViewControllerStatusBarHeight = 20.0f;
@interface TLYShyViewController ()
@ -56,7 +56,11 @@
- (CGFloat)contractionAmountValue
{
return self.sticky ? 0.f : CGRectGetHeight(self.view.bounds);
CGFloat height = CGRectGetHeight(self.view.bounds);
if (self.handleStatusBar && [UIApplication sharedApplication].isStatusBarHidden) {
height -= kTLYShyViewControllerStatusBarHeight;
}
return self.sticky ? 0.f : height;
}
- (CGPoint)contractedCenterValue
@ -188,6 +192,11 @@
}
- (CGFloat)snap:(BOOL)contract
{
return [self snap:contract completion:nil];
}
- (CGFloat)snap:(BOOL)contract completion:(void (^)())completion
{
/* "The Facebook" UX dictates that:
*
@ -211,6 +220,12 @@
{
deltaY = [self.subShyController expand];
}
}
completion:^(BOOL finished)
{
if (completion && finished) {
completion();
}
}];
return deltaY;

View File

@ -0,0 +1,15 @@
//
// TLYShyNavBar.h
// TLYShyNavBar
//
#import <Foundation/Foundation.h>
//! Project version number for TLYShyNavBar.
FOUNDATION_EXPORT double TLYShyNavBarVersionNumber;
//! Project version string for TLYShyNavBar.
FOUNDATION_EXPORT const unsigned char TLYShyNavBarVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <TLYShyNavBar/PublicHeader.h>
#import <TLYShyNavBar/TLYShyNavBarManager.h>

View File

@ -10,6 +10,7 @@
#import <UIKit/UIKit.h>
#import "TLYShyNavBarFade.h"
@protocol TLYShyNavBarManagerDelegate;
/** CLASS DESCRIPTION:
* ==================
@ -54,7 +55,7 @@
*/
@property (nonatomic) BOOL stickyExtensionView;
/* Control the resistance when scrolling up/down before the navbar
/* Control the resistance when scrolling up/down before the navbar
* expands/contracts again.
*/
@property (nonatomic) CGFloat expansionResistance; // default 200
@ -70,6 +71,31 @@
*/
@property (nonatomic) BOOL disable;
/* Use this to be notified about contraction and expansion events.
*/
@property (nonatomic, weak) id<TLYShyNavBarManagerDelegate> delegate;
@property (nonatomic) BOOL handleStatusBar;
@property (nonatomic) BOOL contracted;
@property (nonatomic) BOOL expanded;
- (void)expandWithCompletion:(void (^)())completion;
@end
/* PROTOCOL DESCRIPTION:
* =====================
* This protocol is used to notify an optional TLYShyNavBarManager's delegate
* when a contraction or expansion finishes animating.
*/
@protocol TLYShyNavBarManagerDelegate <NSObject>
@optional
- (void)shyNavBarManagerDidBecomeFullyContracted:(TLYShyNavBarManager *) shyNavBarManager;
- (void)shyNavBarManagerDidFinishContracting:(TLYShyNavBarManager *) shyNavBarManager;
- (void)shyNavBarManagerDidFinishExpanding:(TLYShyNavBarManager *) shyNavBarManager;
@end
@ -89,5 +115,15 @@
/* Initially, this is nil, but created for you when you access it */
@property (nonatomic, strong) TLYShyNavBarManager *shyNavBarManager;
@end
/*
* Set the TLYShyNavBarManager while also specifying a view controller
*/
- (void)setShyNavBarManager:(TLYShyNavBarManager *)shyNavBarManager
viewController:(UIViewController *)viewController;
/* Use this to find out if a TLYShyNavBarManager instance was associated
* to this view controller, without triggering its creation and association.
*/
- (BOOL)isShyNavBarManagerPresent;
@end

View File

@ -56,17 +56,17 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage
if (self)
{
self.delegateProxy = [[TLYDelegateProxy alloc] initWithMiddleMan:self];
/* Initialize defaults */
self.contracting = NO;
self.previousContractionState = YES;
self.expansionResistance = 200.f;
self.contractionResistance = 0.f;
self.fadeBehavior = TLYShyNavBarFadeSubviews;
self.previousYOffset = NAN;
/* Initialize shy controllers */
self.statusBarController = [[TLYShyStatusBarController alloc] init];
self.scrollViewController = [[TLYShyScrollViewController alloc] init];
@ -75,10 +75,10 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage
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;
/* hierarchy setup */
/* StatusBar <-- navbar <-->> extension <--> scrollView
*/
@ -88,7 +88,7 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage
self.extensionController.parent = self.navBarController;
self.extensionController.child = self.scrollViewController;
self.scrollViewController.parent = self.extensionController;
/* Notification helpers */
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(applicationDidBecomeActive:)
@ -110,7 +110,7 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage
{
_scrollView.delegate = _delegateProxy.originalDelegate;
}
[[NSNotificationCenter defaultCenter] removeObserver:self];
[_scrollView removeObserver:self forKeyPath:@"contentSize" context:kTLYShyNavBarManagerKVOContext];
}
@ -120,47 +120,55 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage
- (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, @"Please make sure the viewController is already attached to a navigation controller.");
viewController.extendedLayoutIncludesOpaqueBars = YES;
[self.extensionViewContainer removeFromSuperview];
[self.viewController.view addSubview:self.extensionViewContainer];
self.navBarController.view = navbar;
[self layoutViews];
}
- (void)setScrollView:(UIScrollView *)scrollView
{
[_scrollView removeObserver:self forKeyPath:@"contentSize" context:kTLYShyNavBarManagerKVOContext];
if (_scrollView.delegate == self.delegateProxy)
{
_scrollView.delegate = self.delegateProxy.originalDelegate;
}
_scrollView = scrollView;
self.scrollViewController.scrollView = scrollView;
NSUInteger index = [scrollView.subviews indexOfObjectPassingTest:^BOOL (id obj, NSUInteger idx, BOOL *stop) {
return [obj isKindOfClass:[UIRefreshControl class]];
}];
if (index != NSNotFound) {
self.scrollViewController.refreshControl = [scrollView.subviews objectAtIndex:index];
}
if (_scrollView.delegate != self.delegateProxy)
{
self.delegateProxy.originalDelegate = _scrollView.delegate;
_scrollView.delegate = (id)self.delegateProxy;
}
[self cleanup];
[self layoutViews];
[_scrollView addObserver:self forKeyPath:@"contentSize" options:0 context:kTLYShyNavBarManagerKVOContext];
}
@ -208,6 +216,25 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage
self.extensionController.sticky = stickyExtensionView;
}
- (BOOL)handleStatusBar
{
return self.navBarController.handleStatusBar;
}
- (void)setHandleStatusBar:(BOOL)handleStatusBar
{
self.navBarController.handleStatusBar = handleStatusBar;
}
- (BOOL)contracted
{
return self.navBarController.contracted;
}
- (BOOL)expanded
{
return self.navBarController.expanded;
}
#pragma mark - Private methods
@ -224,7 +251,7 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage
{
return NO;
}
return (self.isViewControllerVisible && [self _scrollViewIsSuffecientlyLong]);
}
@ -234,7 +261,7 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage
{
return;
}
if (!isnan(self.previousYOffset))
{
// 1 - Calculate the delta
@ -246,20 +273,20 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage
{
deltaY = MIN(0, deltaY - (self.previousYOffset - start));
}
/* rounding to resolve a dumb issue with the contentOffset value */
CGFloat end = floorf(self.scrollView.contentSize.height - CGRectGetHeight(self.scrollView.bounds) + self.scrollView.contentInset.bottom - 0.5f);
if (self.previousYOffset > end && deltaY > 0)
{
deltaY = MAX(0, deltaY - self.previousYOffset + end);
}
// 3 - Update contracting variable
if (fabs(deltaY) > FLT_EPSILON)
{
self.contracting = deltaY < 0;
}
// 4 - Check if contracting state changed, and do stuff if so
if (self.contracting != self.previousContractionState)
{
@ -269,7 +296,7 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage
// 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)
@ -284,17 +311,31 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage
{
CGFloat availableResistance = self.expansionResistance - self.resistanceConsumed;
self.resistanceConsumed = MIN(self.expansionResistance, self.resistanceConsumed + deltaY);
deltaY = MAX(0, deltaY - availableResistance);
}
// 6 - Update the navigation bar shyViewController
self.navBarController.fadeBehavior = self.fadeBehavior;
// 7 - Inform the delegate if needed
CGFloat maxNavY = CGRectGetMaxY(self.navBarController.view.frame);
CGFloat maxExtensionY = CGRectGetMaxY(self.extensionViewContainer.frame);
CGFloat visibleTop;
if (self.extensionViewContainer.hidden) {
visibleTop = maxNavY;
} else {
visibleTop = MAX(maxNavY, maxExtensionY);
}
if (visibleTop == self.statusBarController.calculateTotalHeightRecursively) {
if ([self.delegate respondsToSelector:@selector(shyNavBarManagerDidBecomeFullyContracted:)]) {
[self.delegate shyNavBarManagerDidBecomeFullyContracted:self];
}
}
[self.navBarController updateYOffset:deltaY];
}
self.previousYOffset = self.scrollView.contentOffset.y;
}
@ -304,9 +345,26 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage
{
return;
}
__weak __typeof(self) weakSelf;
void (^completion)() = ^
{
__typeof(self) strongSelf = self;
if (strongSelf) {
if (strongSelf.contracting) {
if ([strongSelf.delegate respondsToSelector:@selector(shyNavBarManagerDidFinishContracting:)]) {
[strongSelf.delegate shyNavBarManagerDidFinishContracting:strongSelf];
}
} else {
if ([strongSelf.delegate respondsToSelector:@selector(shyNavBarManagerDidFinishExpanding:)]) {
[strongSelf.delegate shyNavBarManagerDidFinishExpanding:strongSelf];
}
}
}
};
self.resistanceConsumed = 0;
[self.navBarController snap:self.contracting];
[self.navBarController snap:self.contracting completion:completion];
}
#pragma mark - KVO
@ -337,12 +395,12 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage
{
[_extensionView removeFromSuperview];
_extensionView = view;
CGRect bounds = view.frame;
bounds.origin = CGPointZero;
view.frame = bounds;
self.extensionViewContainer.frame = bounds;
[self.extensionViewContainer addSubview:view];
self.extensionViewContainer.userInteractionEnabled = view.userInteractionEnabled;
@ -363,7 +421,7 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage
- (void)layoutViews
{
if (fabs([self.scrollViewController updateLayoutIfNeeded:YES]) > FLT_EPSILON)
if (fabs([self.scrollViewController updateLayoutIfNeeded]) > FLT_EPSILON)
{
[self.navBarController expand];
[self.extensionViewContainer.superview bringSubviewToFront:self.extensionViewContainer];
@ -376,6 +434,17 @@ static void * const kTLYShyNavBarManagerKVOContext = (void*)&kTLYShyNavBarManage
self.previousYOffset = NAN;
}
- (void)expandWithCompletion:(void (^)())completion
{
[UIView animateWithDuration:0.2 animations:^ {
[self cleanup];
} completion:^(BOOL finished) {
if (completion) {
completion();
}
}];
}
#pragma mark - UIScrollViewDelegate methods
- (void)scrollViewDidScroll:(UIScrollView *)scrollView
@ -454,12 +523,26 @@ static char shyNavBarManagerKey;
[self tly_swizzledViewWillDisappear:animated];
}
#pragma mark - Public methods
- (BOOL)isShyNavBarManagerPresent
{
return [self _internalShyNavBarManager] != nil;
}
- (void)setShyNavBarManager:(TLYShyNavBarManager *)shyNavBarManager
viewController:(UIViewController *)viewController
{
NSAssert(viewController != nil, @"viewController must not be nil!");
shyNavBarManager.viewController = viewController;
objc_setAssociatedObject(self, &shyNavBarManagerKey, shyNavBarManager, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
}
#pragma mark - Properties
- (void)setShyNavBarManager:(TLYShyNavBarManager *)shyNavBarManager
{
shyNavBarManager.viewController = self;
objc_setAssociatedObject(self, &shyNavBarManagerKey, shyNavBarManager, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
[self setShyNavBarManager:shyNavBarManager viewController:self];
}
- (TLYShyNavBarManager *)shyNavBarManager
@ -470,7 +553,7 @@ static char shyNavBarManagerKey;
shyNavBarManager = [[TLYShyNavBarManager alloc] init];
self.shyNavBarManager = shyNavBarManager;
}
return shyNavBarManager;
}

View File

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9060" systemVersion="14F1021" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="7bU-2Z-BIA">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15B42" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="7bU-2Z-BIA">
<dependencies>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9051"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
@ -84,7 +84,7 @@
<rect key="frame" x="15" y="0.0" width="270" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@ -104,7 +104,7 @@
<rect key="frame" x="15" y="0.0" width="270" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@ -124,7 +124,7 @@
<rect key="frame" x="15" y="0.0" width="270" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@ -144,7 +144,7 @@
<rect key="frame" x="15" y="0.0" width="270" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@ -164,7 +164,7 @@
<rect key="frame" x="15" y="0.0" width="270" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@ -184,7 +184,7 @@
<rect key="frame" x="15" y="0.0" width="270" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@ -204,7 +204,7 @@
<rect key="frame" x="15" y="0.0" width="270" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@ -224,7 +224,7 @@
<rect key="frame" x="15" y="0.0" width="270" height="43.5"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<fontDescription key="fontDescription" type="system" pointSize="16"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@ -353,7 +353,7 @@
<label opaque="NO" userInteractionEnabled="NO" tag="777" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="Label" textAlignment="natural" lineBreakMode="tailTruncation" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0Vf-lE-VWT">
<rect key="frame" x="8" y="14" width="42" height="21"/>
<fontDescription key="fontDescription" type="system" pointSize="17"/>
<color key="textColor" cocoaTouchSystemColor="darkTextColor"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="1" colorSpace="calibratedRGB"/>
<nil key="highlightedColor"/>
</label>
</subviews>
@ -388,8 +388,8 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="zXM-Us-jtQ">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="zXM-Us-jtQ">
<rect key="frame" x="0.0" y="64" width="320" height="504"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" id="NX5-B0-7pf">
@ -408,6 +408,12 @@
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="zXM-Us-jtQ" firstAttribute="leading" secondItem="MSO-HM-o3C" secondAttribute="leading" id="YGz-6i-F6M"/>
<constraint firstAttribute="right" secondItem="zXM-Us-jtQ" secondAttribute="right" id="g44-Ka-P9F"/>
<constraint firstItem="sgb-uZ-rF7" firstAttribute="top" secondItem="zXM-Us-jtQ" secondAttribute="bottom" id="hhN-uq-WOi"/>
<constraint firstItem="zXM-Us-jtQ" firstAttribute="top" secondItem="XjM-9z-Uam" secondAttribute="bottom" id="t3N-xs-ko0"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="l8b-W3-Ehj"/>
<connections>
@ -620,15 +626,15 @@
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<tableView clipsSubviews="YES" contentMode="scaleToFill" fixedFrame="YES" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Nlh-YW-jQ7">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<tableView clipsSubviews="YES" contentMode="scaleToFill" alwaysBounceVertical="YES" dataMode="prototypes" style="plain" separatorStyle="default" rowHeight="44" sectionHeaderHeight="28" sectionFooterHeight="28" translatesAutoresizingMaskIntoConstraints="NO" id="Nlh-YW-jQ7">
<rect key="frame" x="0.0" y="64" width="335" height="504"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<prototypes>
<tableViewCell clipsSubviews="YES" contentMode="scaleToFill" selectionStyle="blue" hidesAccessoryWhenEditing="NO" indentationLevel="1" indentationWidth="0.0" reuseIdentifier="Cell" id="jHM-wp-EHl">
<rect key="frame" x="0.0" y="92" width="320" height="44"/>
<rect key="frame" x="0.0" y="92" width="335" height="44"/>
<autoresizingMask key="autoresizingMask"/>
<tableViewCellContentView key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" tableViewCell="jHM-wp-EHl" id="mGW-Ao-Srl">
<rect key="frame" x="0.0" y="0.0" width="320" height="43.5"/>
<rect key="frame" x="0.0" y="0.0" width="335" height="43.5"/>
<autoresizingMask key="autoresizingMask"/>
</tableViewCellContentView>
</tableViewCell>
@ -640,6 +646,12 @@
</tableView>
</subviews>
<color key="backgroundColor" white="1" alpha="1" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="Nlh-YW-jQ7" firstAttribute="left" secondItem="Trg-X5-aIb" secondAttribute="left" id="1rE-jk-8qx"/>
<constraint firstItem="PvV-4v-hBz" firstAttribute="top" secondItem="Nlh-YW-jQ7" secondAttribute="bottom" id="H5W-2J-f2D"/>
<constraint firstAttribute="right" secondItem="Nlh-YW-jQ7" secondAttribute="rightMargin" id="K6c-aA-di4"/>
<constraint firstItem="Nlh-YW-jQ7" firstAttribute="top" secondItem="2aT-xe-cs2" secondAttribute="bottom" id="oJF-s6-iWb"/>
</constraints>
</view>
<navigationItem key="navigationItem" id="uJw-Uj-Sb1"/>
<userDefinedRuntimeAttributes>