Merge pull request #100 from kovpas/master
iOS example app code cleanup.
Showing
3 changed files
with
15 additions
and
7 deletions
@@ -60,9 +60,13 @@ static NSString * const kMASCellReuseIdentifier = @"kMASCellReuseIdentifier"; | @@ -60,9 +60,13 @@ static NSString * const kMASCellReuseIdentifier = @"kMASCellReuseIdentifier"; | ||
60 | viewClass:MASExampleArrayView.class], | 60 | viewClass:MASExampleArrayView.class], |
61 | [[MASExampleViewController alloc] initWithTitle:@"Attribute Chaining" | 61 | [[MASExampleViewController alloc] initWithTitle:@"Attribute Chaining" |
62 | viewClass:MASExampleAttributeChainingView.class], | 62 | viewClass:MASExampleAttributeChainingView.class], |
63 | - [[MASExampleLayoutGuideViewController alloc] init], | ||
64 | ]; | 63 | ]; |
65 | 64 | ||
65 | + if ([UIViewController instancesRespondToSelector:@selector(topLayoutGuide)]) | ||
66 | + { | ||
67 | + self.exampleControllers = [self.exampleControllers arrayByAddingObject:[[MASExampleLayoutGuideViewController alloc] init]]; | ||
68 | + } | ||
69 | + | ||
66 | return self; | 70 | return self; |
67 | } | 71 | } |
68 | 72 |
@@ -33,12 +33,14 @@ | @@ -33,12 +33,14 @@ | ||
33 | 33 | ||
34 | self.topLeft = YES; | 34 | self.topLeft = YES; |
35 | 35 | ||
36 | - // make sure updateConstraints gets called | ||
37 | - [self setNeedsUpdateConstraints]; | ||
38 | - | ||
39 | return self; | 36 | return self; |
40 | } | 37 | } |
41 | 38 | ||
39 | ++ (BOOL)requiresConstraintBasedLayout | ||
40 | +{ | ||
41 | + return YES; | ||
42 | +} | ||
43 | + | ||
42 | // this is Apple's recommended place for adding/updating constraints | 44 | // this is Apple's recommended place for adding/updating constraints |
43 | - (void)updateConstraints { | 45 | - (void)updateConstraints { |
44 | 46 |
@@ -31,12 +31,14 @@ | @@ -31,12 +31,14 @@ | ||
31 | 31 | ||
32 | self.buttonSize = CGSizeMake(100, 100); | 32 | self.buttonSize = CGSizeMake(100, 100); |
33 | 33 | ||
34 | - // make sure updateConstraints gets called | ||
35 | - [self setNeedsUpdateConstraints]; | ||
36 | - | ||
37 | return self; | 34 | return self; |
38 | } | 35 | } |
39 | 36 | ||
37 | ++ (BOOL)requiresConstraintBasedLayout | ||
38 | +{ | ||
39 | + return YES; | ||
40 | +} | ||
41 | + | ||
40 | // this is Apple's recommended place for adding/updating constraints | 42 | // this is Apple's recommended place for adding/updating constraints |
41 | - (void)updateConstraints { | 43 | - (void)updateConstraints { |
42 | 44 |
-
Please register or login to post a comment