This commit is contained in:
giuseppenuc committed 2016-04-04 19:30:43 +02:00
1 parent 143d532745
commit 0c0c28a31d
12 files changed
+1325 -1206

No files matched your search

+3 -2
View File
@@ -9,7 +9,8 @@ PODS:
- FBSnapshotTestCase/Core (2.1.0)
- FBSnapshotTestCase/SwiftSupport (2.1.0):
- FBSnapshotTestCase/Core
- GradientButton (0.1.4)
- GradientButton (0.1.4):
- PureLayout
- PureLayout (3.0.1)
- Specta (1.0.5)
@@ -29,7 +30,7 @@ SPEC CHECKSUMS:
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
Expecta+Snapshots: c343f410c7a6392f3e22e78f94c44b6c0749a516
FBSnapshotTestCase: 366ecd378511d7716c79991cd8067d1eed23578d
GradientButton: 44bc0921357db40e4860b3e6af5d1fe54078e800
GradientButton: 24bf08379bcb51dec67a250920e4f523af177966
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
+6 -1
View File
@@ -21,5 +21,10 @@
"Pod/Assets/*.png"
]
},
"frameworks": "QuartzCore"
"frameworks": "QuartzCore",
"dependencies": {
"PureLayout": [
]
}
}
+3 -2
View File
@@ -9,7 +9,8 @@ PODS:
- FBSnapshotTestCase/Core (2.1.0)
- FBSnapshotTestCase/SwiftSupport (2.1.0):
- FBSnapshotTestCase/Core
- GradientButton (0.1.4)
- GradientButton (0.1.4):
- PureLayout
- PureLayout (3.0.1)
- Specta (1.0.5)
@@ -29,7 +30,7 @@ SPEC CHECKSUMS:
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
Expecta+Snapshots: c343f410c7a6392f3e22e78f94c44b6c0749a516
FBSnapshotTestCase: 366ecd378511d7716c79991cd8067d1eed23578d
GradientButton: 44bc0921357db40e4860b3e6af5d1fe54078e800
GradientButton: 24bf08379bcb51dec67a250920e4f523af177966
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
+1240 -1168
View File
File diff suppressed because it is too large. Load diff
@@ -14,7 +14,7 @@
buildForArchiving = "YES">
<BuildableReference
BuildableIdentifier = 'primary'
BlueprintIdentifier = '71AFE04B13EC9CD3D9995CD6'
BlueprintIdentifier = '7E070188C2CFA00BC528E820'
BlueprintName = 'GradientButton'
ReferencedContainer = 'container:Pods.xcodeproj'
BuildableName = 'GradientButton.framework'>
@@ -24,6 +24,19 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
## PureLayout
This code is distributed under the terms and conditions of the MIT license.
Copyright (c) 2014-2015 Tyler Fox
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
## Expecta
Copyright (c) 2011-2015 Specta Team - https://github.com/specta
@@ -39,6 +39,23 @@ THE SOFTWARE.
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>This code is distributed under the terms and conditions of the MIT license.
Copyright (c) 2014-2015 Tyler Fox
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
</string>
<key>Title</key>
<string>PureLayout</string>
<key>Type</key>
<string>PSGroupSpecifier</string>
</dict>
<dict>
<key>FooterText</key>
<string>Copyright (c) 2011-2015 Specta Team - https://github.com/specta
@@ -85,6 +85,7 @@ strip_invalid_archs() {
if [[ "$CONFIGURATION" == "Debug" ]]; then
install_framework "Pods-GradientButton_Tests/GradientButton.framework"
install_framework "Pods-GradientButton_Tests/PureLayout.framework"
install_framework "Pods-GradientButton_Tests/Expecta.framework"
install_framework "Pods-GradientButton_Tests/Expecta_Snapshots.framework"
install_framework "Pods-GradientButton_Tests/FBSnapshotTestCase.framework"
@@ -92,6 +93,7 @@ if [[ "$CONFIGURATION" == "Debug" ]]; then
fi
if [[ "$CONFIGURATION" == "Release" ]]; then
install_framework "Pods-GradientButton_Tests/GradientButton.framework"
install_framework "Pods-GradientButton_Tests/PureLayout.framework"
install_framework "Pods-GradientButton_Tests/Expecta.framework"
install_framework "Pods-GradientButton_Tests/Expecta_Snapshots.framework"
install_framework "Pods-GradientButton_Tests/FBSnapshotTestCase.framework"
@@ -1,8 +1,8 @@
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Expecta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta_Snapshots.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/GradientButton.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Specta.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSnapshotTestCase" -framework "GradientButton" -framework "Specta"
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Expecta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta_Snapshots.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/GradientButton.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Specta.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSnapshotTestCase" -framework "GradientButton" -framework "PureLayout" -framework "Specta"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-GradientButton_Tests
PODS_ROOT = ${SRCROOT}/Pods
@@ -1,8 +1,8 @@
EMBEDDED_CONTENT_CONTAINS_SWIFT = YES
GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1
LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks'
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Expecta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta_Snapshots.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/GradientButton.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Specta.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSnapshotTestCase" -framework "GradientButton" -framework "Specta"
OTHER_CFLAGS = $(inherited) -iquote "$CONFIGURATION_BUILD_DIR/Expecta.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Expecta_Snapshots.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/FBSnapshotTestCase.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/GradientButton.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/PureLayout.framework/Headers" -iquote "$CONFIGURATION_BUILD_DIR/Specta.framework/Headers"
OTHER_LDFLAGS = $(inherited) -framework "Expecta" -framework "Expecta_Snapshots" -framework "FBSnapshotTestCase" -framework "GradientButton" -framework "PureLayout" -framework "Specta"
OTHER_SWIFT_FLAGS = $(inherited) "-D" "COCOAPODS"
PODS_FRAMEWORK_BUILD_PATH = $(BUILD_DIR)/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/Pods-GradientButton_Tests
PODS_ROOT = ${SRCROOT}/Pods
+2 -2
View File
@@ -8,7 +8,7 @@
Pod::Spec.new do |s|
s.name = "GradientButton"
s.version = "0.1.4"
s.version = "0.1.5"
s.summary = "GradientButton is a UIBUtton subclassing with gradient support"
# This description is used to generate tags and improve search results.
@@ -34,5 +34,5 @@ s.resource_bundles = {
# s.public_header_files = 'Pod/Classes/**/*.h'
s.frameworks = 'QuartzCore'
# s.dependency 'AFNetworking', '~> 2.3'
s.dependency 'PureLayout'
end
+34 -26
View File
@@ -7,6 +7,7 @@
//
#import "GradientButton.h"
#import "PureLayout.h"
@interface GradientButton()
@@ -15,6 +16,8 @@
@property (nonatomic, strong) NSMutableArray *cgColors;
@property (nonatomic) CGPoint startPoint;
@property (nonatomic) BOOL didUpdateConstraints;
@property (nonatomic, strong) UIView *container;
@property (nonatomic, assign) BOOL didSetupConstraints;
@end
@@ -24,9 +27,15 @@
- (instancetype) init {
self = [super init];
if (self) {
[self addObserver:self forKeyPath:@"bounds" options:0 context:nil];
_colors = [[NSMutableArray alloc] init];
_cgColors = [[NSMutableArray alloc] init];
_container = [UIView newAutoLayoutView];
[_container setBackgroundColor:[UIColor clearColor]];
[_container setAlpha:0];
[self addSubview:_container];
[_container addObserver:self forKeyPath:@"bounds" options:0 context:nil];
}
return self;
}
@@ -34,9 +43,14 @@
- (instancetype) initWithCoder:(NSCoder *)aDecoder {
self = [super initWithCoder:aDecoder];
if (self) {
[self addObserver:self forKeyPath:@"bounds" options:0 context:nil];
_colors = [[NSMutableArray alloc] init];
_cgColors = [[NSMutableArray alloc] init];
_container = [UIView newAutoLayoutView];
[_container setBackgroundColor:[UIColor clearColor]];
[_container setAlpha:0];
[self addSubview:_container];
[_container addObserver:self forKeyPath:@"bounds" options:0 context:nil];
}
return self;
}
@@ -44,35 +58,18 @@
- (instancetype) initWithFrame:(CGRect)frame {
self = [super initWithFrame:frame];
if (self) {
[self addObserver:self forKeyPath:@"bounds" options:0 context:nil];
_colors = [[NSMutableArray alloc] init];
_cgColors = [[NSMutableArray alloc] init];
_container = [[UIView alloc] initWithFrame:CGRectMake(0,0,frame.size.width,frame.size.height)];
[_container setBackgroundColor:[UIColor clearColor]];
[_container setAlpha:0];
[self addSubview:_container];
[_container addObserver:self forKeyPath:@"bounds" options:0 context:nil];
}
return self;
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
// Drawing code
}
UIColor *topColor = [@"fd843e" colorFromHex];
UIColor *bottomColor = [@"ff4e50" colorFromHex];
CAGradientLayer *checkoutButtonViewGradient = [CAGradientLayer layer];
checkoutButtonViewGradient.colors = [NSArray arrayWithObjects: (id)topColor.CGColor, (id)bottomColor.CGColor, nil];
checkoutButtonViewGradient.frame = _checkoutButton.bounds;
checkoutButtonViewGradient.startPoint = CGPointMake(0, 0);
[_checkoutButton.layer insertSublayer:checkoutButtonViewGradient atIndex:0];
*/
- (void) setbackgroundLayerWithColors:(NSArray *) colors startPoint:(CGPoint) startPoint {
if (colors && [colors count] > 0) {
_colors = [[NSMutableArray alloc] initWithArray:colors];
@@ -112,8 +109,19 @@
}
}
- (void) updateConstraints {
[super updateConstraints];
if (!self.didSetupConstraints) {
[_container autoPinEdgesToSuperviewEdges];
[_container autoAlignAxisToSuperviewAxis:ALAxisHorizontal];
[_container autoAlignAxisToSuperviewAxis:ALAxisVertical];
}
}
- (void) setFrame:(CGRect)frame {
[super setFrame:frame];
[_container setFrame:CGRectMake(0,0,frame.size.width,frame.size.height)];
dispatch_async(dispatch_get_main_queue(), ^{
if (_gradientLayer) {
[self setbackgroundLayerWithColors:_colors startPoint:_startPoint];
@@ -145,7 +153,7 @@
- (void) dealloc {
[self removeObserver:self forKeyPath:@"bounds"];
[_container removeObserver:self forKeyPath:@"bounds"];
}