Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
e2055059a2 | ||
|
|
6245b8be13 | ||
|
|
50d92f3c3b | ||
|
|
afddd1e959 | ||
|
|
52ac833f7c |
No files matched your search
@@ -10,12 +10,14 @@
|
|||||||
#import "GradientButton.h"
|
#import "GradientButton.h"
|
||||||
#import "PureLayout/PureLayout.h"
|
#import "PureLayout/PureLayout.h"
|
||||||
|
|
||||||
|
|
||||||
@interface gradiendButtonViewController () {
|
@interface gradiendButtonViewController () {
|
||||||
|
|
||||||
GradientButton *button;
|
GradientButton *button;
|
||||||
GradientButton *autoLayoutButton;
|
GradientButton *autoLayoutButton;
|
||||||
BOOL didUpdateConstraints;
|
BOOL didUpdateConstraints;
|
||||||
|
|
||||||
|
UIButton *presentControllerButton;
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
@@ -42,6 +44,13 @@
|
|||||||
|
|
||||||
[self.view addSubview:autoLayoutButton];
|
[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.
|
// Do any additional setup after loading the view, typically from a nib.
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,11 +107,26 @@
|
|||||||
[autoLayoutButton autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:40];
|
[autoLayoutButton autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:40];
|
||||||
[autoLayoutButton autoSetDimension:ALDimensionHeight toSize:50];
|
[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;
|
didUpdateConstraints = YES;
|
||||||
}
|
}
|
||||||
[super updateViewConstraints];
|
[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
|
- (void)didReceiveMemoryWarning
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ PODS:
|
|||||||
- FBSnapshotTestCase/Core (2.1.0)
|
- FBSnapshotTestCase/Core (2.1.0)
|
||||||
- FBSnapshotTestCase/SwiftSupport (2.1.0):
|
- FBSnapshotTestCase/SwiftSupport (2.1.0):
|
||||||
- FBSnapshotTestCase/Core
|
- FBSnapshotTestCase/Core
|
||||||
- GradientButton (0.1.4):
|
- GradientButton (0.2.0):
|
||||||
- PureLayout
|
- PureLayout
|
||||||
- PureLayout (3.0.1)
|
- PureLayout (3.0.1)
|
||||||
- Specta (1.0.5)
|
- Specta (1.0.5)
|
||||||
@@ -30,7 +30,7 @@ SPEC CHECKSUMS:
|
|||||||
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
|
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
|
||||||
Expecta+Snapshots: c343f410c7a6392f3e22e78f94c44b6c0749a516
|
Expecta+Snapshots: c343f410c7a6392f3e22e78f94c44b6c0749a516
|
||||||
FBSnapshotTestCase: 366ecd378511d7716c79991cd8067d1eed23578d
|
FBSnapshotTestCase: 366ecd378511d7716c79991cd8067d1eed23578d
|
||||||
GradientButton: 24bf08379bcb51dec67a250920e4f523af177966
|
GradientButton: 7be2c4bc564d0cfe7c3043a4410723d95050cc0d
|
||||||
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
|
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
|
||||||
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
||||||
|
|
||||||
|
|||||||
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "GradientButton",
|
"name": "GradientButton",
|
||||||
"version": "0.1.4",
|
"version": "0.2.0",
|
||||||
"summary": "GradientButton is a UIBUtton subclassing with gradient support",
|
"summary": "GradientButton is a UIBUtton subclassing with gradient support",
|
||||||
"homepage": "https://github.com/giuseppenucifora/GradientButton",
|
"homepage": "https://github.com/giuseppenucifora/GradientButton",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -9,7 +9,7 @@
|
|||||||
},
|
},
|
||||||
"source": {
|
"source": {
|
||||||
"git": "https://github.com/giuseppenucifora/GradientButton.git",
|
"git": "https://github.com/giuseppenucifora/GradientButton.git",
|
||||||
"tag": "0.1.4"
|
"tag": "0.2.0"
|
||||||
},
|
},
|
||||||
"platforms": {
|
"platforms": {
|
||||||
"ios": "7.0"
|
"ios": "7.0"
|
||||||
|
|||||||
Generated
+2
-2
@@ -9,7 +9,7 @@ PODS:
|
|||||||
- FBSnapshotTestCase/Core (2.1.0)
|
- FBSnapshotTestCase/Core (2.1.0)
|
||||||
- FBSnapshotTestCase/SwiftSupport (2.1.0):
|
- FBSnapshotTestCase/SwiftSupport (2.1.0):
|
||||||
- FBSnapshotTestCase/Core
|
- FBSnapshotTestCase/Core
|
||||||
- GradientButton (0.1.4):
|
- GradientButton (0.2.0):
|
||||||
- PureLayout
|
- PureLayout
|
||||||
- PureLayout (3.0.1)
|
- PureLayout (3.0.1)
|
||||||
- Specta (1.0.5)
|
- Specta (1.0.5)
|
||||||
@@ -30,7 +30,7 @@ SPEC CHECKSUMS:
|
|||||||
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
|
Expecta: e1c022fcd33910b6be89c291d2775b3fe27a89fe
|
||||||
Expecta+Snapshots: c343f410c7a6392f3e22e78f94c44b6c0749a516
|
Expecta+Snapshots: c343f410c7a6392f3e22e78f94c44b6c0749a516
|
||||||
FBSnapshotTestCase: 366ecd378511d7716c79991cd8067d1eed23578d
|
FBSnapshotTestCase: 366ecd378511d7716c79991cd8067d1eed23578d
|
||||||
GradientButton: 24bf08379bcb51dec67a250920e4f523af177966
|
GradientButton: 7be2c4bc564d0cfe7c3043a4410723d95050cc0d
|
||||||
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
|
PureLayout: f35f5384c9c4e4479df041dbe33ad7577b71ddfb
|
||||||
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
Specta: ac94d110b865115fe60ff2c6d7281053c6f8e8a2
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -14,7 +14,7 @@
|
|||||||
buildForArchiving = "YES">
|
buildForArchiving = "YES">
|
||||||
<BuildableReference
|
<BuildableReference
|
||||||
BuildableIdentifier = 'primary'
|
BuildableIdentifier = 'primary'
|
||||||
BlueprintIdentifier = '7E070188C2CFA00BC528E820'
|
BlueprintIdentifier = 'A005A3C52F8B1643B0539EAB'
|
||||||
BlueprintName = 'GradientButton'
|
BlueprintName = 'GradientButton'
|
||||||
ReferencedContainer = 'container:Pods.xcodeproj'
|
ReferencedContainer = 'container:Pods.xcodeproj'
|
||||||
BuildableName = 'GradientButton.framework'>
|
BuildableName = 'GradientButton.framework'>
|
||||||
|
|||||||
+1
-1
@@ -15,7 +15,7 @@
|
|||||||
<key>CFBundlePackageType</key>
|
<key>CFBundlePackageType</key>
|
||||||
<string>FMWK</string>
|
<string>FMWK</string>
|
||||||
<key>CFBundleShortVersionString</key>
|
<key>CFBundleShortVersionString</key>
|
||||||
<string>0.1.4</string>
|
<string>0.2.0</string>
|
||||||
<key>CFBundleSignature</key>
|
<key>CFBundleSignature</key>
|
||||||
<string>????</string>
|
<string>????</string>
|
||||||
<key>CFBundleVersion</key>
|
<key>CFBundleVersion</key>
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
Pod::Spec.new do |s|
|
Pod::Spec.new do |s|
|
||||||
s.name = "GradientButton"
|
s.name = "GradientButton"
|
||||||
s.version = "0.1.5"
|
s.version = "0.2.0"
|
||||||
s.summary = "GradientButton is a UIBUtton subclassing with gradient support"
|
s.summary = "GradientButton is a UIBUtton subclassing with gradient support"
|
||||||
|
|
||||||
# This description is used to generate tags and improve search results.
|
# This description is used to generate tags and improve search results.
|
||||||
|
|||||||
@@ -16,8 +16,6 @@
|
|||||||
@property (nonatomic, strong) NSMutableArray *cgColors;
|
@property (nonatomic, strong) NSMutableArray *cgColors;
|
||||||
@property (nonatomic) CGPoint startPoint;
|
@property (nonatomic) CGPoint startPoint;
|
||||||
@property (nonatomic) BOOL didUpdateConstraints;
|
@property (nonatomic) BOOL didUpdateConstraints;
|
||||||
@property (nonatomic, strong) UIView *container;
|
|
||||||
@property (nonatomic, assign) BOOL didSetupConstraints;
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@@ -30,12 +28,6 @@
|
|||||||
|
|
||||||
_colors = [[NSMutableArray alloc] init];
|
_colors = [[NSMutableArray alloc] init];
|
||||||
_cgColors = [[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;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -45,12 +37,6 @@
|
|||||||
if (self) {
|
if (self) {
|
||||||
_colors = [[NSMutableArray alloc] init];
|
_colors = [[NSMutableArray alloc] init];
|
||||||
_cgColors = [[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;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -60,12 +46,6 @@
|
|||||||
if (self) {
|
if (self) {
|
||||||
_colors = [[NSMutableArray alloc] init];
|
_colors = [[NSMutableArray alloc] init];
|
||||||
_cgColors = [[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;
|
return self;
|
||||||
}
|
}
|
||||||
@@ -109,19 +89,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) updateConstraints {
|
|
||||||
[super updateConstraints];
|
|
||||||
|
|
||||||
if (!self.didSetupConstraints) {
|
|
||||||
[_container autoPinEdgesToSuperviewEdges];
|
|
||||||
[_container autoAlignAxisToSuperviewAxis:ALAxisHorizontal];
|
|
||||||
[_container autoAlignAxisToSuperviewAxis:ALAxisVertical];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
- (void) setFrame:(CGRect)frame {
|
- (void) setFrame:(CGRect)frame {
|
||||||
[super setFrame:frame];
|
[super setFrame:frame];
|
||||||
[_container setFrame:CGRectMake(0,0,frame.size.width,frame.size.height)];
|
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
dispatch_async(dispatch_get_main_queue(), ^{
|
||||||
if (_gradientLayer) {
|
if (_gradientLayer) {
|
||||||
[self setbackgroundLayerWithColors:_colors startPoint:_startPoint];
|
[self setbackgroundLayerWithColors:_colors startPoint:_startPoint];
|
||||||
@@ -143,18 +114,10 @@
|
|||||||
{
|
{
|
||||||
if (object == self && [keyPath isEqualToString:@"bounds"]) {
|
if (object == self && [keyPath isEqualToString:@"bounds"]) {
|
||||||
if(_gradientLayer) {
|
if(_gradientLayer) {
|
||||||
dispatch_async(dispatch_get_main_queue(), ^{
|
[self setbackgroundLayerWithColors:_colors startPoint:_startPoint];
|
||||||
[self setbackgroundLayerWithColors:_colors startPoint:_startPoint];
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
- (void) dealloc {
|
|
||||||
|
|
||||||
[_container removeObserver:self forKeyPath:@"bounds"];
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@end
|
@end
|
||||||
Reference in new issue
Block a user