From 11900f880b17e0898a4656d91c5e37ba7a5d576c Mon Sep 17 00:00:00 2001 From: Giuseppe Nucifora Date: Mon, 11 Jan 2016 19:48:41 +0100 Subject: [PATCH] Release 0.1.0 --- .../gradiendButtonViewController.m | 105 ++++++++++-------- GradientButton.podspec | 1 - README.md | 20 ++++ 3 files changed, 76 insertions(+), 50 deletions(-) diff --git a/Example/GradientButton/gradiendButtonViewController.m b/Example/GradientButton/gradiendButtonViewController.m index 5556d2f..3aea1dc 100644 --- a/Example/GradientButton/gradiendButtonViewController.m +++ b/Example/GradientButton/gradiendButtonViewController.m @@ -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; } diff --git a/GradientButton.podspec b/GradientButton.podspec index 2d6d4e0..2b517b4 100644 --- a/GradientButton.podspec +++ b/GradientButton.podspec @@ -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" diff --git a/README.md b/README.md index ff593f2..42dc70e 100644 --- a/README.md +++ b/README.md @@ -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