Authored by Daniel Hammond

Fixing Code Formatting

... ... @@ -19,8 +19,7 @@ static CGFloat const kArrayExampleIncrement = 10.0;
@implementation MASExampleArrayView
- (id)init
{
- (id)init {
self = [super init];
if (!self) return nil;
... ... @@ -56,29 +55,24 @@ static CGFloat const kArrayExampleIncrement = 10.0;
return self;
}
- (void)centerAction
{
- (void)centerAction {
self.offset = 0.0;
}
- (void)raiseAction
{
- (void)raiseAction {
self.offset -= kArrayExampleIncrement;
}
- (void)lowerAction
{
- (void)lowerAction {
self.offset += kArrayExampleIncrement;
}
- (void)setOffset:(CGFloat)offset
{
- (void)setOffset:(CGFloat)offset {
_offset = offset;
[self setNeedsUpdateConstraints];
}
- (void)updateConstraints
{
- (void)updateConstraints {
[super updateConstraints];
[self.buttonViews updateConstraints:^(MASConstraintMaker *make) {
make.baseline.equalTo(self.mas_centerY).with.offset(self.offset);
... ...
... ... @@ -11,8 +11,7 @@
@implementation NSArray (MASAdditions)
- (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *make))block
{
- (NSArray *)mas_makeConstraints:(void(^)(MASConstraintMaker *make))block {
NSMutableArray *constraints = [NSMutableArray array];
for (UIView *view in self) {
NSAssert([view isKindOfClass:[UIView class]], @"All objects in the array must be views");
... ... @@ -21,8 +20,7 @@
return constraints;
}
- (NSArray *)mas_updateConstraints:(void(^)(MASConstraintMaker *make))block
{
- (NSArray *)mas_updateConstraints:(void(^)(MASConstraintMaker *make))block {
NSMutableArray *constraints = [NSMutableArray array];
for (UIView *view in self) {
NSAssert([view isKindOfClass:[UIView class]], @"All objects in the array must be views");
... ...
... ... @@ -7,7 +7,7 @@ For examples take a look at the **Masonry iOS Examples** project in the Masonry
## Whats wrong with NSLayoutConstraints?
Under the hood Auto Layout is a powerful and flexible way of organizing and laying out your views. However creating constraints from code is verbose and not very descriptive.
Under the hood Auto Layout is a powerful and flexible way of organising and laying out your views. However creating constraints from code is verbose and not very descriptive.
Imagine a simple example in which you want to have a view fill its superview but inset by 10 pixels on every side
```obj-c
UIView *superview = self;
... ...