Browse Source

iOS example app code cleanup.

Pavel Mazurin 11 years ago
parent
commit
08bc473268

+ 5 - 1
Examples/Masonry iOS Examples/MASExampleListViewController.m

@@ -60,9 +60,13 @@ static NSString * const kMASCellReuseIdentifier = @"kMASCellReuseIdentifier";
                                               viewClass:MASExampleArrayView.class],
                                               viewClass:MASExampleArrayView.class],
         [[MASExampleViewController alloc] initWithTitle:@"Attribute Chaining"
         [[MASExampleViewController alloc] initWithTitle:@"Attribute Chaining"
                                               viewClass:MASExampleAttributeChainingView.class],
                                               viewClass:MASExampleAttributeChainingView.class],
-        [[MASExampleLayoutGuideViewController alloc] init],
     ];
     ];
     
     
+    if ([UIViewController instancesRespondToSelector:@selector(topLayoutGuide)])
+    {
+        self.exampleControllers = [self.exampleControllers arrayByAddingObject:[[MASExampleLayoutGuideViewController alloc] init]];
+    }
+    
     return self;
     return self;
 }
 }
 
 

+ 5 - 3
Examples/Masonry iOS Examples/MASExampleRemakeView.m

@@ -33,12 +33,14 @@
     
     
     self.topLeft = YES;
     self.topLeft = YES;
     
     
-    // make sure updateConstraints gets called
-    [self setNeedsUpdateConstraints];
-    
     return self;
     return self;
 }
 }
 
 
++ (BOOL)requiresConstraintBasedLayout
+{
+    return YES;
+}
+
 // this is Apple's recommended place for adding/updating constraints
 // this is Apple's recommended place for adding/updating constraints
 - (void)updateConstraints {
 - (void)updateConstraints {
     
     

+ 5 - 3
Examples/Masonry iOS Examples/MASExampleUpdateView.m

@@ -31,12 +31,14 @@
 
 
     self.buttonSize = CGSizeMake(100, 100);
     self.buttonSize = CGSizeMake(100, 100);
 
 
-    // make sure updateConstraints gets called
-    [self setNeedsUpdateConstraints];
-
     return self;
     return self;
 }
 }
 
 
++ (BOOL)requiresConstraintBasedLayout
+{
+    return YES;
+}
+
 // this is Apple's recommended place for adding/updating constraints
 // this is Apple's recommended place for adding/updating constraints
 - (void)updateConstraints {
 - (void)updateConstraints {