7 Commits
Author SHA1 Message Date
giuseppenuc e2055059a2 no message 2016-04-05 15:41:49 +02:00
Giuseppe Nucifora 6245b8be13 Merge branch 'master' into 'develop'
Merge branch 'develop' into 'master'

Develop



See merge request !2

See merge request !3
2016-04-05 15:26:18 +02:00
Giuseppe Nucifora 50d92f3c3b Merge branch 'develop' into 'master'
Develop



See merge request !2
2016-04-05 15:24:24 +02:00
giuseppenuc afddd1e959 - Fix dealloc crash 2016-04-05 15:23:13 +02:00
giuseppenuc 52ac833f7c - Fix dealloc crash 2016-04-05 11:19:35 +02:00
Giuseppe Nucifora 49e429c393 Merge branch 'develop' into 'master'
- Fix



See merge request !1
2016-04-04 19:32:11 +02:00
giuseppenuc 0c0c28a31d - Fix 2016-04-04 19:30:43 +02:00
14 changed files with 1323 additions and 1217 deletions

No files matched your search

@@ -10,12 +10,14 @@
#import "GradientButton.h"
#import "PureLayout/PureLayout.h"
@interface gradiendButtonViewController () {
GradientButton *button;
GradientButton *autoLayoutButton;
BOOL didUpdateConstraints;
UIButton *presentControllerButton;
}
@end
@@ -42,6 +44,13 @@
[self.view addSubview:autoLayoutButton];
presentControllerButton = [UIButton newAutoLayoutView];
[presentControllerButton setTitle:@"Presenta Conttoller" forState:UIControlStateNormal];
[presentControllerButton addTarget:self action:@selector(presentAction:) forControlEvents:UIControlEventTouchUpInside];
[presentControllerButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[self.view addSubview:presentControllerButton];
// Do any additional setup after loading the view, typically from a nib.
}
@@ -98,11 +107,26 @@
[autoLayoutButton autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:40];
[autoLayoutButton autoSetDimension:ALDimensionHeight toSize:50];
[presentControllerButton autoMatchDimension:ALDimensionHeight toDimension:ALDimensionHeight ofView:autoLayoutButton];
[presentControllerButton autoMatchDimension:ALDimensionWidth toDimension:ALDimensionWidth ofView:autoLayoutButton];
[presentControllerButton autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:autoLayoutButton];
[presentControllerButton autoAlignAxisToSuperviewAxis:ALAxisVertical];
didUpdateConstraints = YES;
}
[super updateViewConstraints];
}
- (void) presentAction:(UIButton *) sender {
gradiendButtonViewController *viewController = [[gradiendButtonViewController alloc] init];
[self presentViewController:viewController animated:YES completion:nil];
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[viewController dismissViewControllerAnimated:YES completion:nil];
});
}
- (void)didReceiveMemoryWarning
{
+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.2.0):
- 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: 7be2c4bc564d0cfe7c3043a4410723d95050cc0d
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
+8 -3
View File
@@ -1,6 +1,6 @@
{
"name": "GradientButton",
"version": "0.1.4",
"version": "0.2.0",
"summary": "GradientButton is a UIBUtton subclassing with gradient support",
"homepage": "https://github.com/giuseppenucifora/GradientButton",
"license": "MIT",
@@ -9,7 +9,7 @@
},
"source": {
"git": "https://github.com/giuseppenucifora/GradientButton.git",
"tag": "0.1.4"
"tag": "0.2.0"
},
"platforms": {
"ios": "7.0"
@@ -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.2.0):
- 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: 7be2c4bc564d0cfe7c3043a4410723d95050cc0d
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 = 'A005A3C52F8B1643B0539EAB'
BlueprintName = 'GradientButton'
ReferencedContainer = 'container:Pods.xcodeproj'
BuildableName = 'GradientButton.framework'>
+1 -1
View File
@@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>0.1.4</string>
<string>0.2.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
@@ -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.2.0"
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
+5 -34
View File
@@ -7,6 +7,7 @@
//
#import "GradientButton.h"
#import "PureLayout.h"
@interface GradientButton()
@@ -24,7 +25,7 @@
- (instancetype) init {
self = [super init];
if (self) {
[self addObserver:self forKeyPath:@"bounds" options:0 context:nil];
_colors = [[NSMutableArray alloc] init];
_cgColors = [[NSMutableArray alloc] init];
}
@@ -34,7 +35,6 @@
- (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];
}
@@ -44,35 +44,12 @@
- (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];
}
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,6 +89,8 @@
}
}
- (void) setFrame:(CGRect)frame {
[super setFrame:frame];
dispatch_async(dispatch_get_main_queue(), ^{
@@ -135,18 +114,10 @@
{
if (object == self && [keyPath isEqualToString:@"bounds"]) {
if(_gradientLayer) {
dispatch_async(dispatch_get_main_queue(), ^{
[self setbackgroundLayerWithColors:_colors startPoint:_startPoint];
});
[self setbackgroundLayerWithColors:_colors startPoint:_startPoint];
}
}
}
- (void) dealloc {
[self removeObserver:self forKeyPath:@"bounds"];
}
@end