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
+40 -14

No files matched your search

@@ -13,6 +13,7 @@
@interface gradiendButtonViewController () { @interface gradiendButtonViewController () {
GradientButton *button; GradientButton *button;
GradientButton *autoLayoutButton;
BOOL didUpdateConstraints; BOOL didUpdateConstraints;
} }
@@ -25,14 +26,22 @@
{ {
[super viewDidLoad]; [super viewDidLoad];
//button = [[GradientButton alloc] initWithFrame:CGRectMake(0, 0, 200, 50)]; button = [[GradientButton alloc] initWithFrame:CGRectMake(0, 0, 200, 50)];
button = [GradientButton newAutoLayoutView]; [button setCenter:self.view.center];
//[button setCenter:self.view.center]; [button setTitle:@"Normal Button" forState:UIControlStateNormal];
[button setTitle:@"Prove" forState:UIControlStateNormal];
[button setTitleColor:[UIColor blackColor] 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]; [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. // Do any additional setup after loading the view, typically from a nib.
} }
@@ -40,8 +49,7 @@
- (void) viewDidAppear:(BOOL)animated { - (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(), ^{
/*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)]; [button setbackgroundLayerWithColors:@[[UIColor redColor],[UIColor blueColor], [UIColor redColor], [UIColor greenColor]] startPoint:CGPointMake(0, 1)];
}); });
@@ -78,18 +86,17 @@
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(12 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(12 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
[button.layer setCornerRadius:25]; [button.layer setCornerRadius:25];
[button.layer setMasksToBounds:YES]; [button.layer setMasksToBounds:YES];
});*/ });
} }
- (void) updateViewConstraints { - (void) updateViewConstraints {
if(!didUpdateConstraints) { if(!didUpdateConstraints) {
[button autoAlignAxisToSuperviewAxis:ALAxisHorizontal]; [autoLayoutButton autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:50];
[button autoAlignAxisToSuperviewAxis:ALAxisVertical]; [autoLayoutButton autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:40];
[button autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:40]; [autoLayoutButton autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:40];
[button autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:40]; [autoLayoutButton autoSetDimension:ALDimensionHeight toSize:50];
[button autoSetDimension:ALDimensionHeight toSize:50];
didUpdateConstraints = YES; 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. # * Try to keep it short, snappy and to the point.
# * Write the description between the DESC delimiters below. # * Write the description between the DESC delimiters below.
# * Finally, don't worry about the indent, CocoaPods strips it! # * Finally, don't worry about the indent, CocoaPods strips it!
#s.description = <<-DESCDESC
s.homepage = "https://github.com/giuseppenucifora/GradientButton" s.homepage = "https://github.com/giuseppenucifora/GradientButton"
# s.screenshots = "www.example.com/screenshots_1", "www.example.com/screenshots_2" # 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" 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 ## Author
Giuseppe Nucifora, me@giuseppenucifora.com Giuseppe Nucifora, me@giuseppenucifora.com