Skip to content

Commit

Permalink
Added checks for a nil tapCircle thanks to GitHub user [Adam Szeptycki](
Browse files Browse the repository at this point in the history
https://github.com/adamszeptycki). Added LaunchScreen.xib and updated project to recommended settings (Xcode 7.2) to get full screen layout.
  • Loading branch information
bfeher committed Feb 25, 2016
1 parent fb68954 commit 3567e0f
Show file tree
Hide file tree
Showing 12 changed files with 110 additions and 55 deletions.
4 changes: 2 additions & 2 deletions BFPaperButton.podspec
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

Pod::Spec.new do |s|
s.name = "BFPaperButton"
s.version = "2.0.18"
s.version = "2.0.27"
s.summary = "A flat button inspired by Google Material Design's Paper theme."
s.homepage = "https://github.com/bfeher/BFPaperButton"
s.license = { :type => 'MIT', :file => 'LICENSE.md' }
s.author = { "Bence Feher" => "ben.feher@gmail.com" }
s.source = { :git => "https://github.com/bfeher/BFPaperButton.git", :tag => "2.0.18" }
s.source = { :git => "https://github.com/bfeher/BFPaperButton.git", :tag => "2.0.27" }
s.platform = :ios, '7.0'
s.dependency 'UIColor+BFPaperColors'

Expand Down
13 changes: 10 additions & 3 deletions BFPaperButton.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
objects = {

/* Begin PBXBuildFile section */
505ABA1D1C7E7BBE00B76BDF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 505ABA1C1C7E7BBE00B76BDF /* LaunchScreen.storyboard */; };
55FFD66AAF204A9CB9263275 /* libPods.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 06DB54154CCF4D8789C3CAC5 /* libPods.a */; };
EDD3C703DB1C7C025A8D9D18 /* libPods-BFPaperButtonTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 29A3EE64683DBC96E9815A26 /* libPods-BFPaperButtonTests.a */; };
F42B5BA61978DC9300D6F4B5 /* BFPaperButton.m in Sources */ = {isa = PBXBuildFile; fileRef = F42B5BA51978DC9300D6F4B5 /* BFPaperButton.m */; };
Expand Down Expand Up @@ -41,6 +42,7 @@
289ABA5861550F9FC1DF4B31 /* Pods.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.release.xcconfig; path = "Pods/Target Support Files/Pods/Pods.release.xcconfig"; sourceTree = "<group>"; };
29A3EE64683DBC96E9815A26 /* libPods-BFPaperButtonTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-BFPaperButtonTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
4837025DC55EFC272A8F0080 /* Pods.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = Pods.debug.xcconfig; path = "Pods/Target Support Files/Pods/Pods.debug.xcconfig"; sourceTree = "<group>"; };
505ABA1C1C7E7BBE00B76BDF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; path = LaunchScreen.storyboard; sourceTree = "<group>"; };
899E17FD75E8F4028B15A891 /* Pods-BFPaperButtonTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-BFPaperButtonTests.release.xcconfig"; path = "Pods/Target Support Files/Pods-BFPaperButtonTests/Pods-BFPaperButtonTests.release.xcconfig"; sourceTree = "<group>"; };
F42B5BA41978DC9300D6F4B5 /* BFPaperButton.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = BFPaperButton.h; path = ../Classes/BFPaperButton.h; sourceTree = "<group>"; };
F42B5BA51978DC9300D6F4B5 /* BFPaperButton.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; name = BFPaperButton.m; path = ../Classes/BFPaperButton.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -143,6 +145,7 @@
F46DDB3819761BF600D26097 /* BFPaperAppDelegate.h */,
F46DDB3919761BF600D26097 /* BFPaperAppDelegate.m */,
F46DDB3B19761BF600D26097 /* Main.storyboard */,
505ABA1C1C7E7BBE00B76BDF /* LaunchScreen.storyboard */,
F46DDB3E19761BF600D26097 /* BFPaperViewController.h */,
F46DDB3F19761BF600D26097 /* BFPaperViewController.m */,
F46DDB4119761BF600D26097 /* Images.xcassets */,
Expand Down Expand Up @@ -239,7 +242,7 @@
isa = PBXProject;
attributes = {
CLASSPREFIX = BFPaper;
LastUpgradeCheck = 0510;
LastUpgradeCheck = 0720;
ORGANIZATIONNAME = "Bence Feher";
TargetAttributes = {
F46DDB4619761BF600D26097 = {
Expand Down Expand Up @@ -272,6 +275,7 @@
buildActionMask = 2147483647;
files = (
F46DDB4219761BF600D26097 /* Images.xcassets in Resources */,
505ABA1D1C7E7BBE00B76BDF /* LaunchScreen.storyboard in Resources */,
F46DDB3419761BF600D26097 /* InfoPlist.strings in Resources */,
F46DDB3D19761BF600D26097 /* Main.storyboard in Resources */,
);
Expand Down Expand Up @@ -439,6 +443,7 @@
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
COPY_PHASE_STRIP = NO;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = gnu99;
GCC_DYNAMIC_NO_PIC = NO;
GCC_OPTIMIZATION_LEVEL = 0;
Expand Down Expand Up @@ -498,11 +503,11 @@
baseConfigurationReference = 4837025DC55EFC272A8F0080 /* Pods.debug.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "BFPaperButton/BFPaperButton-Prefix.pch";
INFOPLIST_FILE = "BFPaperButton/BFPaperButton-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.bencefeher.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
"USER_HEADER_SEARCH_PATHS[arch=*]" = "\"$(SRCROOT)/Pods/Headers\"/** \"$(BUILT_PRODUCTS_DIR)\"/** \"${PODS_ROOT}/BuildHeaders\"/**";
WRAPPER_EXTENSION = app;
Expand All @@ -514,11 +519,11 @@
baseConfigurationReference = 289ABA5861550F9FC1DF4B31 /* Pods.release.xcconfig */;
buildSettings = {
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "BFPaperButton/BFPaperButton-Prefix.pch";
INFOPLIST_FILE = "BFPaperButton/BFPaperButton-Info.plist";
IPHONEOS_DEPLOYMENT_TARGET = 7.0;
PRODUCT_BUNDLE_IDENTIFIER = "com.bencefeher.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
"USER_HEADER_SEARCH_PATHS[arch=*]" = "\"$(SRCROOT)/Pods/Headers\"/** \"$(BUILT_PRODUCTS_DIR)\"/** \"${PODS_ROOT}/BuildHeaders\"/**";
WRAPPER_EXTENSION = app;
Expand All @@ -542,6 +547,7 @@
"$(inherited)",
);
INFOPLIST_FILE = "BFPaperButtonTests/BFPaperButtonTests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "com.bencefeher.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
Expand All @@ -561,6 +567,7 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "BFPaperButton/BFPaperButton-Prefix.pch";
INFOPLIST_FILE = "BFPaperButtonTests/BFPaperButtonTests-Info.plist";
PRODUCT_BUNDLE_IDENTIFIER = "com.bencefeher.${PRODUCT_NAME:rfc1034identifier}";
PRODUCT_NAME = "$(TARGET_NAME)";
TEST_HOST = "$(BUNDLE_LOADER)";
WRAPPER_EXTENSION = xctest;
Expand Down
6 changes: 4 additions & 2 deletions BFPaperButton/BFPaperButton-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.bencefeher.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
Expand All @@ -21,9 +21,11 @@
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>18</string>
<string>27</string>
<key>LSRequiresIPhoneOS</key>
<true/>
<key>UILaunchStoryboardName</key>
<string>LaunchScreen</string>
<key>UIMainStoryboardFile</key>
<string>Main</string>
<key>UIRequiredDeviceCapabilities</key>
Expand Down
13 changes: 5 additions & 8 deletions BFPaperButton/Base.lproj/Main.storyboard
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6245" systemVersion="13F34" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="9532" systemVersion="15D21" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" initialViewController="vXZ-lx-hvc">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6238"/>
<deployment identifier="iOS"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="9530"/>
</dependencies>
<scenes>
<!--Paper View Controller-->
Expand All @@ -13,20 +14,16 @@
<viewControllerLayoutGuide type="bottom" id="2fi-mo-0CV"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="kh9-bI-dsS">
<rect key="frame" x="0.0" y="0.0" width="320" height="568"/>
<rect key="frame" x="0.0" y="0.0" width="414" height="736"/>
<autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMaxY="YES"/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
<navigationItem key="navigationItem" id="33l-vu-fDd"/>
<simulatedScreenMetrics key="simulatedDestinationMetrics" type="retina55"/>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="x5A-6p-PRh" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="260" y="271"/>
</scene>
</scenes>
<simulatedMetricsContainer key="defaultSimulatedMetrics">
<simulatedStatusBarMetrics key="statusBar"/>
<simulatedOrientationMetrics key="orientation"/>
<simulatedScreenMetrics key="destination" type="retina4"/>
</simulatedMetricsContainer>
</document>
10 changes: 10 additions & 0 deletions BFPaperButton/Images.xcassets/AppIcon.appiconset/Contents.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,21 @@
"size" : "29x29",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "29x29",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "2x"
},
{
"idiom" : "iphone",
"size" : "40x40",
"scale" : "3x"
},
{
"idiom" : "iphone",
"size" : "60x60",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,14 @@
{
"orientation" : "portrait",
"idiom" : "iphone",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"scale" : "2x"
},
{
"orientation" : "portrait",
"idiom" : "iphone",
"subtype" : "retina4",
"extent" : "full-screen",
"minimum-system-version" : "7.0",
"subtype" : "retina4",
"scale" : "2x"
}
],
Expand Down
6 changes: 6 additions & 0 deletions BFPaperButton/Images.xcassets/Contents.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"info" : {
"version" : 1,
"author" : "xcode"
}
}
27 changes: 27 additions & 0 deletions BFPaperButton/LaunchScreen.storyboard
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="8150" systemVersion="15A204g" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" launchScreen="YES" useTraitCollections="YES" initialViewController="01J-lp-oVM">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="8122"/>
</dependencies>
<scenes>
<!--View Controller-->
<scene sceneID="EHf-IW-A2E">
<objects>
<viewController id="01J-lp-oVM" sceneMemberID="viewController">
<layoutGuides>
<viewControllerLayoutGuide type="top" id="Llm-lL-Icb"/>
<viewControllerLayoutGuide type="bottom" id="xb3-aO-Qok"/>
</layoutGuides>
<view key="view" contentMode="scaleToFill" id="Ze5-6b-2t3">
<rect key="frame" x="0.0" y="0.0" width="600" height="600"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<animations/>
<color key="backgroundColor" white="1" alpha="1" colorSpace="custom" customColorSpace="calibratedWhite"/>
</view>
</viewController>
<placeholder placeholderIdentifier="IBFirstResponder" id="iYj-Kq-Ea1" userLabel="First Responder" sceneMemberID="firstResponder"/>
</objects>
<point key="canvasLocation" x="53" y="375"/>
</scene>
</scenes>
</document>
2 changes: 1 addition & 1 deletion BFPaperButtonTests/BFPaperButtonTests-Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIdentifier</key>
<string>com.bencefeher.${PRODUCT_NAME:rfc1034identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundlePackageType</key>
Expand Down
8 changes: 7 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ BFPaperButton


2.0.27
---------
+ Added LaunchScreen.xib to get fullscreen for iPhone 5 and up. (Lazy demo app doesn't scroll so iPhone 4 and down won't fit evertying on screen.)
+^ Modified BFPaperButton.m to check if tapCircles are nil first (credit goes to github user [Adam Szeptycki](https://github.com/adamszeptycki))


2.0.18
---------
+ ^ Fixed bug where loweredShadowOffset property wasn't being utilized and instead was ignored for a hardcoded default value.
+^ Fixed bug where loweredShadowOffset property wasn't being utilized and instead was ignored for a hardcoded default value.
70 changes: 36 additions & 34 deletions Classes/BFPaperButton.m
Original file line number Diff line number Diff line change
Expand Up @@ -665,41 +665,43 @@ - (void)burstTapCircle

// Get the next tap circle to expand:
CAShapeLayer *tapCircle = [self.rippleAnimationQueue firstObject];
if (self.rippleAnimationQueue.count > 0) {
[self.rippleAnimationQueue removeObjectAtIndex:0];
}
[self.deathRowForCircleLayers addObject:tapCircle];


CGPathRef startingPath = tapCircle.path;
CGFloat startingOpacity = tapCircle.opacity;

if ([[tapCircle animationKeys] count] > 0) {
startingPath = [[tapCircle presentationLayer] path];
startingOpacity = [[tapCircle presentationLayer] opacity];
if (nil != tapCircle) {
if (self.rippleAnimationQueue.count > 0) {
[self.rippleAnimationQueue removeObjectAtIndex:0];
}
[self.deathRowForCircleLayers addObject:tapCircle];


CGPathRef startingPath = tapCircle.path;
CGFloat startingOpacity = tapCircle.opacity;

if ([[tapCircle animationKeys] count] > 0) {
startingPath = [[tapCircle presentationLayer] path];
startingOpacity = [[tapCircle presentationLayer] opacity];
}

// Burst tap-circle:
CABasicAnimation *tapCircleGrowthAnimation = [CABasicAnimation animationWithKeyPath:@"path"];
tapCircleGrowthAnimation.duration = self.touchUpAnimationDuration;
tapCircleGrowthAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
tapCircleGrowthAnimation.fromValue = (__bridge id)startingPath;
tapCircleGrowthAnimation.toValue = (__bridge id)endingCirclePath.CGPath;
tapCircleGrowthAnimation.fillMode = kCAFillModeForwards;
tapCircleGrowthAnimation.removedOnCompletion = NO;

// Fade tap-circle out:
CABasicAnimation *fadeOut = [CABasicAnimation animationWithKeyPath:@"opacity"];
[fadeOut setValue:@"fadeCircleOut" forKey:@"id"];
fadeOut.delegate = self;
fadeOut.fromValue = [NSNumber numberWithFloat:startingOpacity];
fadeOut.toValue = [NSNumber numberWithFloat:0.f];
fadeOut.duration = self.touchUpAnimationDuration;
fadeOut.fillMode = kCAFillModeForwards;
fadeOut.removedOnCompletion = NO;

[tapCircle addAnimation:tapCircleGrowthAnimation forKey:@"animatePath"];
[tapCircle addAnimation:fadeOut forKey:@"opacityAnimation"];
}

// Burst tap-circle:
CABasicAnimation *tapCircleGrowthAnimation = [CABasicAnimation animationWithKeyPath:@"path"];
tapCircleGrowthAnimation.duration = self.touchUpAnimationDuration;
tapCircleGrowthAnimation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseOut];
tapCircleGrowthAnimation.fromValue = (__bridge id)startingPath;
tapCircleGrowthAnimation.toValue = (__bridge id)endingCirclePath.CGPath;
tapCircleGrowthAnimation.fillMode = kCAFillModeForwards;
tapCircleGrowthAnimation.removedOnCompletion = NO;

// Fade tap-circle out:
CABasicAnimation *fadeOut = [CABasicAnimation animationWithKeyPath:@"opacity"];
[fadeOut setValue:@"fadeCircleOut" forKey:@"id"];
fadeOut.delegate = self;
fadeOut.fromValue = [NSNumber numberWithFloat:startingOpacity];
fadeOut.toValue = [NSNumber numberWithFloat:0.f];
fadeOut.duration = self.touchUpAnimationDuration;
fadeOut.fillMode = kCAFillModeForwards;
fadeOut.removedOnCompletion = NO;

[tapCircle addAnimation:tapCircleGrowthAnimation forKey:@"animatePath"];
[tapCircle addAnimation:fadeOut forKey:@"opacityAnimation"];
}

- (CGFloat)calculateTapCircleFinalDiameter
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ Learn more at http://cocoapods.org
Add this to your podfile to add BFPaperButton to your project.
```ruby
platform :ios, '7.0'
pod 'BFPaperButton', '~> 2.0.18'
pod 'BFPaperButton'
```


Expand Down

0 comments on commit 3567e0f

Please sign in to comment.