Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'auto_update' of https://github.com/cloudkite/Masonry
- Loading branch information
Showing
16 changed files
with
207 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
MasonryExamples/Masonry iOS Examples/MASExampleUpdateView.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// | ||
// MASExampleUpdateView.h | ||
// Masonry iOS Examples | ||
// | ||
// Created by Jonas Budelmann on 3/11/13. | ||
// Copyright (c) 2013 Jonas Budelmann. All rights reserved. | ||
// | ||
|
||
#import <UIKit/UIKit.h> | ||
|
||
@interface MASExampleUpdateView : UIView | ||
|
||
@end |
59 changes: 59 additions & 0 deletions
59
MasonryExamples/Masonry iOS Examples/MASExampleUpdateView.m
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
// | ||
// MASExampleUpdateView.m | ||
// Masonry iOS Examples | ||
// | ||
// Created by Jonas Budelmann on 3/11/13. | ||
// Copyright (c) 2013 Jonas Budelmann. All rights reserved. | ||
// | ||
|
||
#import "MASExampleUpdateView.h" | ||
|
||
@interface MASExampleUpdateView () | ||
|
||
@property (nonatomic, strong) UIButton *growingButton; | ||
@property (nonatomic, assign) CGSize buttonSize; | ||
|
||
@end | ||
|
||
@implementation MASExampleUpdateView | ||
|
||
- (id)init { | ||
self = [super init]; | ||
if (!self) return nil; | ||
|
||
self.growingButton = [UIButton buttonWithType:UIButtonTypeSystem]; | ||
[self.growingButton setTitle:@"Grow Me!" forState:UIControlStateNormal]; | ||
self.growingButton.layer.borderColor = UIColor.greenColor.CGColor; | ||
self.growingButton.layer.borderWidth = 2; | ||
|
||
[self.growingButton addTarget:self action:@selector(didTapGrowButton:) forControlEvents:UIControlEventTouchUpInside]; | ||
[self addSubview:self.growingButton]; | ||
|
||
self.buttonSize = CGSizeMake(100, 100); | ||
[self setNeedsUpdateConstraints]; | ||
|
||
return self; | ||
} | ||
|
||
- (void)updateConstraints { | ||
[super updateConstraints]; | ||
|
||
[self.growingButton updateConstraints:^(MASConstraintMaker *make) { | ||
make.center.equalTo(self); | ||
make.width.equalTo(@(self.buttonSize.width)); | ||
make.height.equalTo(@(self.buttonSize.height)); | ||
}]; | ||
} | ||
|
||
- (void)didTapGrowButton:(UIButton *)button { | ||
self.buttonSize = CGSizeMake(self.buttonSize.width * 1.1, self.buttonSize.height * 1.1); | ||
|
||
[self setNeedsUpdateConstraints]; | ||
[self updateConstraintsIfNeeded]; | ||
|
||
[UIView animateWithDuration:0.4 animations:^{ | ||
[self layoutIfNeeded]; | ||
}]; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters