Release 0.1.0

This commit is contained in:
giuseppenuc committed 2016-01-11 19:48:41 +01:00
1 parent 03436011a4
commit 11900f880b
3 files changed
+76 -50

No files matched your search

@@ -13,6 +13,7 @@
@interface gradiendButtonViewController () {
GradientButton *button;
GradientButton *autoLayoutButton;
BOOL didUpdateConstraints;
}
@@ -25,14 +26,22 @@
{
[super viewDidLoad];
//button = [[GradientButton alloc] initWithFrame:CGRectMake(0, 0, 200, 50)];
button = [GradientButton newAutoLayoutView];
//[button setCenter:self.view.center];
[button setTitle:@"Prove" forState:UIControlStateNormal];
button = [[GradientButton alloc] initWithFrame:CGRectMake(0, 0, 200, 50)];
[button setCenter:self.view.center];
[button setTitle:@"Normal Button" forState:UIControlStateNormal];
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[button setbackgroundLayerWithColors:@[[UIColor redColor],[UIColor blueColor]] startPoint:CGPointMake(0, 0)];
[button setbackgroundLayerWithColors:@[[UIColor greenColor],[UIColor whiteColor],[UIColor redColor]] startPoint:CGPointMake(0, 0)];
[self.view addSubview:button];
autoLayoutButton = [GradientButton newAutoLayoutView];
[autoLayoutButton setTitle:@"Autolayout Button" forState:UIControlStateNormal];
[autoLayoutButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[autoLayoutButton setbackgroundLayerWithColors:@[[UIColor greenColor],[UIColor whiteColor],[UIColor redColor]] startPoint:CGPointMake(0, 1)];
[self.view addSubview:autoLayoutButton];
// Do any additional setup after loading the view, typically from a nib.
}
@@ -40,56 +49,54 @@
- (void) viewDidAppear:(BOOL)animated {
NSLog(@"viewdidappear : %f %f %f %f",button.bounds.origin.x,button.bounds.origin.y,button.bounds.size.width,button.bounds.size.height);
/*dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[button setbackgroundLayerWithColors:@[[UIColor redColor],[UIColor blueColor], [UIColor redColor], [UIColor greenColor]] startPoint:CGPointMake(0, 1)];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
CGRect rect = button.frame;
rect.size.height = 70;
rect.size.width = 240;
[button setFrame:rect];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[button.layer setCornerRadius:4];
[button.layer setMasksToBounds:YES];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(8 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[button setbackgroundLayerWithColors:@[[UIColor whiteColor],[UIColor blueColor], [UIColor blackColor], [UIColor greenColor]] startPoint:CGPointMake(1, 0)];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(9 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
CGRect rect = button.bounds;
rect.size.height = 50;
rect.size.width = 120;
[button setBounds:rect];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(12 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[button.layer setCornerRadius:25];
[button.layer setMasksToBounds:YES];
});*/
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(2 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[button setbackgroundLayerWithColors:@[[UIColor redColor],[UIColor blueColor], [UIColor redColor], [UIColor greenColor]] startPoint:CGPointMake(0, 1)];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(3 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
CGRect rect = button.frame;
rect.size.height = 70;
rect.size.width = 240;
[button setFrame:rect];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(4 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[button.layer setCornerRadius:4];
[button.layer setMasksToBounds:YES];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(8 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[button setbackgroundLayerWithColors:@[[UIColor whiteColor],[UIColor blueColor], [UIColor blackColor], [UIColor greenColor]] startPoint:CGPointMake(1, 0)];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(9 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
CGRect rect = button.bounds;
rect.size.height = 50;
rect.size.width = 120;
[button setBounds:rect];
});
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(12 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[button.layer setCornerRadius:25];
[button.layer setMasksToBounds:YES];
});
}
- (void) updateViewConstraints {
if(!didUpdateConstraints) {
[button autoAlignAxisToSuperviewAxis:ALAxisHorizontal];
[button autoAlignAxisToSuperviewAxis:ALAxisVertical];
[button autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:40];
[button autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:40];
[button autoSetDimension:ALDimensionHeight toSize:50];
[autoLayoutButton autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:50];
[autoLayoutButton autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:40];
[autoLayoutButton autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:40];
[autoLayoutButton autoSetDimension:ALDimensionHeight toSize:50];
didUpdateConstraints = YES;
}
-1
View File
@@ -16,7 +16,6 @@ s.summary = "GradientButton is a UIBUtton subclassing with gradient sup
# * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it!
#s.description = <<-DESCDESC
s.homepage = "https://github.com/giuseppenucifora/GradientButton"
# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2"
+20
View File
@@ -20,6 +20,26 @@ it, simply add the following line to your Podfile:
pod "GradientButton"
```
```ruby
GradientButton *button = [[GradientButton alloc] initWithFrame:CGRectMake(0, 0, 200, 50)];
[button setCenter:self.view.center];
[button setTitle:@"Normal Button" forState:UIControlStateNormal];
[button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[button setbackgroundLayerWithColors:@[[UIColor redColor],[UIColor blueColor]] startPoint:CGPointMake(0, 0)];
[self.view addSubview:button];
GradientButton *autoLayoutButton = [GradientButton newAutoLayoutView];
[autoLayoutButton setTitle:@"Autolayout Button" forState:UIControlStateNormal];
[autoLayoutButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
[autoLayoutButton setbackgroundLayerWithColors:@[[UIColor redColor],[UIColor greenColor],[UIColor whiteColor]] startPoint:CGPointMake(0, 0)];
[self.view addSubview:autoLayoutButton];
````
## Author
Giuseppe Nucifora, me@giuseppenucifora.com