Răsfoiți Sursa

Merge pull request #100 from kovpas/master

iOS example app code cleanup.
Jonas Budelmann 11 ani în urmă
părinte
comite
d689833bb9

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

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

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

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

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

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