Skip to content

Commit

Permalink
xcode 4.6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
rnystrom committed Aug 29, 2013
1 parent 094415b commit 4035769
Show file tree
Hide file tree
Showing 4 changed files with 368 additions and 89 deletions.
18 changes: 14 additions & 4 deletions README.md
@@ -1,11 +1,19 @@
RNFrostedSidebar
===========

Description
Add your own Control Center-esque UI to your app to work as navigation or even toggle different settings. Blend right into the new iOS 7 design with animated blurs, flat design, and custom animations.

<p align="center"><img src="animation"/></p>
This project is [another](https://github.com/rnystrom/RNRippleTableView) UI control built after finding some [inspiration](http://dribbble.com/shots/1194205-Sidebar-calendar-animation) on Dribbble. The original design was created by [Jakub Antalik](http://dribbble.com/antalik/click?type=twitter).

<p align="center"><img src="details"/></p>
<p align="center"><img title="Open and close animation" src="https://dl.dropboxusercontent.com/u/6715236/open.gif"/></p>

You'll notice that this control's use of blur does not match Jakub's original design exactly. In the original design the background of the buttons is blurred, while the overlay of the control is simply shaded. There have [been](https://github.com/alexdrone/ios-realtimeblur) [attempts](https://github.com/JagCesar/iOS-blur) at recreating

Apple is being a little deceptive with their use of blurring in iOS 7. Bottom line, **don't animate blurs** in your designs.

If you examine the source of this project you'll see that I'm actually cheating to get the blur layer to animate overtop the original view.

<p align="center"><img title="Money shot" src="https://dl.dropboxusercontent.com/u/6715236/click.gif"/></p>

## Installation ##

Expand All @@ -15,11 +23,13 @@ The preferred method of installation is with [CocoaPods](http://cocoapods.org/).
pod 'RNFrostedSidebar', '~> 0.1.0'
```

Or if you want to install manually, drag and drop the <code>RNFrostedSidebar</code> .h and .m files into your project. To get this working, you'll need to include the following frameworks:
Or if you want to install manually, drag and drop the <code>RNFrostedSidebar</code> .h and .m files into your project. To get this working, you'll need to include the following frameworks in *Link Binary with Libraries*:

- QuartzCore
- Accelerate

**Note:** If you want to compile with Xcode 4.*

## Usage ##


Expand Down
50 changes: 25 additions & 25 deletions RNFrostedSidebar.m
Expand Up @@ -6,6 +6,8 @@
// Copyright (c) 2013 Ryan Nystrom. All rights reserved.
//

#define __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED __IPHONE_7_0

#import "RNFrostedSidebar.h"
#import <QuartzCore/QuartzCore.h>

Expand Down Expand Up @@ -384,39 +386,37 @@ - (void)showInViewController:(UIViewController *)controller animated:(BOOL)anima
completion:nil];

CGFloat initDelay = 0.1f;
BOOL useNewAnimationAPIs = [UIView instancesRespondToSelector:@selector(animateWithDuration:delay:usingSpringWithDamping:initialSpringVelocity:options:animations:completion:)];
[self.itemViews enumerateObjectsUsingBlock:^(RNCalloutItemView *view, NSUInteger idx, BOOL *stop) {
view.layer.transform = CATransform3DMakeScale(0.3, 0.3, 1);
view.alpha = 0;
view.originalBackgroundColor = self.itemBackgroundColor;
view.layer.borderWidth = self.borderWidth;

if (useNewAnimationAPIs) {
[UIView animateWithDuration:0.5
delay:(initDelay + idx*0.1f)
usingSpringWithDamping:10
initialSpringVelocity:50
options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
#if __IPHONE_OS_VERSION_SOFT_MAX_REQUIRED
[UIView animateWithDuration:0.5
delay:(initDelay + idx*0.1f)
usingSpringWithDamping:10
initialSpringVelocity:50
options:UIViewAnimationOptionBeginFromCurrentState
animations:^{
view.layer.transform = CATransform3DIdentity;
view.alpha = 1;
}
completion:nil];
#else
[UIView animateWithDuration:0.2
delay:(initDelay + idx*0.1f)
options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationCurveEaseInOut
animations:^{
view.layer.transform = CATransform3DMakeScale(1.1, 1.1, 1);
view.alpha = 1;
}
completion:^(BOOL finished) {
[UIView animateWithDuration:0.1 animations:^{
view.layer.transform = CATransform3DIdentity;
view.alpha = 1;
}
completion:nil];
}
else {
[UIView animateWithDuration:0.2
delay:(initDelay + idx*0.1f)
options:UIViewAnimationOptionBeginFromCurrentState | UIViewAnimationCurveEaseInOut
animations:^{
view.layer.transform = CATransform3DMakeScale(1.1, 1.1, 1);
view.alpha = 1;
}
completion:^(BOOL finished) {
[UIView animateWithDuration:0.1 animations:^{
view.layer.transform = CATransform3DIdentity;
}];
}];
}
}];
#endif
}];
}

Expand Down
Binary file not shown.

0 comments on commit 4035769

Please sign in to comment.