Преглед изворни кода

fixing #define MAS_SHORTHAND

Jonas Budelmann пре 12 година
родитељ
комит
b644282a39

+ 0 - 2
.gitignore

@@ -8,8 +8,6 @@ build/*
 !default.mode2v3
 *.perspectivev3
 !default.perspectivev3
-*.xcworkspace
-!default.xcworkspace
 xcuserdata
 profile
 *.moved-aside

+ 8 - 8
Masonry.xcodeproj/project.pbxproj

@@ -27,6 +27,7 @@
 		DD52F268179CB346005CD195 /* MASViewAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1E1179CAACA005CD195 /* MASViewAttribute.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		DD52F269179CB34A005CD195 /* MASViewConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1E3179CAACA005CD195 /* MASViewConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		DD52F26A179CB365005CD195 /* MASCompositeConstraint.h in Headers */ = {isa = PBXBuildFile; fileRef = DD52F1DC179CAACA005CD195 /* MASCompositeConstraint.h */; settings = {ATTRIBUTES = (Public, ); }; };
+		DDE2653F179D24E600D48565 /* UIView+MASShorthandAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = DDE2653D179D24E600D48565 /* UIView+MASShorthandAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; };
 		F0D61B353FCC42358F962A3C /* libPods-MasonryTests.a in Frameworks */ = {isa = PBXBuildFile; fileRef = DE643A835A4447F4807FDBFA /* libPods-MasonryTests.a */; };
 /* End PBXBuildFile section */
 
@@ -77,6 +78,7 @@
 		DD52F1E5179CAACA005CD195 /* UIView+MASAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+MASAdditions.h"; sourceTree = "<group>"; };
 		DD52F1E6179CAACA005CD195 /* UIView+MASAdditions.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "UIView+MASAdditions.m"; sourceTree = "<group>"; };
 		DD52F1ED179CAAEE005CD195 /* Masonry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Masonry.h; sourceTree = "<group>"; };
+		DDE2653D179D24E600D48565 /* UIView+MASShorthandAdditions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "UIView+MASShorthandAdditions.h"; sourceTree = "<group>"; };
 		DE643A835A4447F4807FDBFA /* libPods-MasonryTests.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-MasonryTests.a"; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
 
@@ -187,6 +189,7 @@
 			children = (
 				DD52F1E5179CAACA005CD195 /* UIView+MASAdditions.h */,
 				DD52F1E6179CAACA005CD195 /* UIView+MASAdditions.m */,
+				DDE2653D179D24E600D48565 /* UIView+MASShorthandAdditions.h */,
 			);
 			name = Additions;
 			sourceTree = "<group>";
@@ -216,6 +219,7 @@
 			files = (
 				DD52F264179CB327005CD195 /* Masonry.h in Headers */,
 				DD52F265179CB32B005CD195 /* UIView+MASAdditions.h in Headers */,
+				DDE2653F179D24E600D48565 /* UIView+MASShorthandAdditions.h in Headers */,
 				DD52F266179CB33F005CD195 /* MASConstraint.h in Headers */,
 				DD52F267179CB342005CD195 /* MASConstraintBuilder.h in Headers */,
 				DD52F268179CB346005CD195 /* MASViewAttribute.h in Headers */,
@@ -459,12 +463,10 @@
 				DSTROOT = /tmp/Masonry.dst;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "Masonry/Masonry-Prefix.pch";
-				OTHER_LDFLAGS = (
-					"-ObjC",
-					"-all_load",
-				);
+				OTHER_LDFLAGS = "-ObjC";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SKIP_INSTALL = YES;
+				VALID_ARCHS = "armv7 armv7s i386 x86_64";
 			};
 			name = Debug;
 		};
@@ -474,12 +476,10 @@
 				DSTROOT = /tmp/Masonry.dst;
 				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 				GCC_PREFIX_HEADER = "Masonry/Masonry-Prefix.pch";
-				OTHER_LDFLAGS = (
-					"-ObjC",
-					"-all_load",
-				);
+				OTHER_LDFLAGS = "-ObjC";
 				PRODUCT_NAME = "$(TARGET_NAME)";
 				SKIP_INSTALL = YES;
+				VALID_ARCHS = "armv7 armv7s i386 x86_64";
 			};
 			name = Release;
 		};

+ 7 - 0
Masonry.xcodeproj/project.xcworkspace/contents.xcworkspacedata

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+   version = "1.0">
+   <FileRef
+      location = "self:Masonry.xcodeproj">
+   </FileRef>
+</Workspace>

+ 13 - 0
Masonry.xcworkspace/contents.xcworkspacedata

@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+   version = "1.0">
+   <FileRef
+      location = "group:Masonry.xcodeproj">
+   </FileRef>
+   <FileRef
+      location = "group:MasonryExamples/MasonryExamples.xcodeproj">
+   </FileRef>
+   <FileRef
+      location = "group:Pods/Pods.xcodeproj">
+   </FileRef>
+</Workspace>

+ 9 - 9
Masonry/MASConstraint.h

@@ -10,15 +10,15 @@
 
 @protocol MASConstraint <NSObject>
 
-@property (nonatomic, strong, readonly) id<MASConstraint> (^insets)(UIEdgeInsets insets);
-@property (nonatomic, strong, readonly) id<MASConstraint> (^sizeOffset)(CGSize offset);
-@property (nonatomic, strong, readonly) id<MASConstraint> (^centerOffset)(CGPoint offset);
-@property (nonatomic, strong, readonly) id<MASConstraint> (^offset)(CGFloat offset);
-@property (nonatomic, strong, readonly) id<MASConstraint> (^percent)(CGFloat percent);
-@property (nonatomic, strong, readonly) id<MASConstraint> (^priority)(UILayoutPriority priority);
-@property (nonatomic, strong, readonly) id<MASConstraint> (^equal)(id attr);
-@property (nonatomic, strong, readonly) id<MASConstraint> (^greaterThanOrEqual)(id attr);
-@property (nonatomic, strong, readonly) id<MASConstraint> (^lessThanOrEqual)(id attr);
+@property (nonatomic, copy, readonly) id<MASConstraint> (^insets)(UIEdgeInsets insets);
+@property (nonatomic, copy, readonly) id<MASConstraint> (^sizeOffset)(CGSize offset);
+@property (nonatomic, copy, readonly) id<MASConstraint> (^centerOffset)(CGPoint offset);
+@property (nonatomic, copy, readonly) id<MASConstraint> (^offset)(CGFloat offset);
+@property (nonatomic, copy, readonly) id<MASConstraint> (^percent)(CGFloat percent);
+@property (nonatomic, copy, readonly) id<MASConstraint> (^priority)(UILayoutPriority priority);
+@property (nonatomic, copy, readonly) id<MASConstraint> (^equal)(id attr);
+@property (nonatomic, copy, readonly) id<MASConstraint> (^greaterThanOrEqual)(id attr);
+@property (nonatomic, copy, readonly) id<MASConstraint> (^lessThanOrEqual)(id attr);
 
 - (void)commit;
 

+ 4 - 0
Masonry/Masonry.h

@@ -7,5 +7,9 @@
 //
 
 #import "UIView+MASAdditions.h"
+#import "UIView+MASShorthandAdditions.h"
+#import "MASConstraint.h"
+#import "MASCompositeConstraint.h"
+#import "MASViewAttribute.h"
 #import "MASViewConstraint.h"
 #import "MASConstraintBuilder.h"

+ 1 - 24
Masonry/UIView+MASAdditions.h

@@ -10,7 +10,6 @@
 #import "MASConstraintBuilder.h"
 #import "MASViewAttribute.h"
 
-
 @interface UIView (MASAdditions)
 
 @property (nonatomic, strong, readonly) MASViewAttribute *mas_left;
@@ -27,26 +26,4 @@
 
 - (void)mas_buildConstraints:(void(^)(MASConstraintBuilder *constraints))block;
 
-@end
-
-#ifdef MAS_SHORTHAND
-
-@interface UIView (MASShortHandAdditions)
-
-@property (nonatomic, strong, readonly) MASViewAttribute *left;
-@property (nonatomic, strong, readonly) MASViewAttribute *top;
-@property (nonatomic, strong, readonly) MASViewAttribute *right;
-@property (nonatomic, strong, readonly) MASViewAttribute *bottom;
-@property (nonatomic, strong, readonly) MASViewAttribute *leading;
-@property (nonatomic, strong, readonly) MASViewAttribute *trailing;
-@property (nonatomic, strong, readonly) MASViewAttribute *width;
-@property (nonatomic, strong, readonly) MASViewAttribute *height;
-@property (nonatomic, strong, readonly) MASViewAttribute *centerX;
-@property (nonatomic, strong, readonly) MASViewAttribute *centerY;
-@property (nonatomic, strong, readonly) MASViewAttribute *baseline;
-
-- (void)buildConstraints:(void(^)(MASConstraintBuilder *constraints))block;
-
-@end
-
-#endif
+@end

+ 1 - 26
Masonry/UIView+MASAdditions.m

@@ -63,29 +63,4 @@
     return [[MASViewAttribute alloc] initWithView:self layoutAttribute:NSLayoutAttributeBaseline];
 }
 
-@end
-
-#define MAS_ATTR_FORWARD(attr)  \
-- (MASViewAttribute *)attr {    \
-    return [self mas_##attr];   \
-}
-
-@implementation UIView (MASShortHandAdditions)
-
-MAS_ATTR_FORWARD(top);
-MAS_ATTR_FORWARD(left);
-MAS_ATTR_FORWARD(bottom);
-MAS_ATTR_FORWARD(right);
-MAS_ATTR_FORWARD(leading);
-MAS_ATTR_FORWARD(trailing);
-MAS_ATTR_FORWARD(width);
-MAS_ATTR_FORWARD(height);
-MAS_ATTR_FORWARD(centerX);
-MAS_ATTR_FORWARD(centerY);
-MAS_ATTR_FORWARD(baseline);
-
-- (void)buildConstraints:(void(^)(MASConstraintBuilder *constraints))block {
-    [self mas_buildConstraints:block];
-}
-
-@end
+@end

+ 57 - 0
Masonry/UIView+MASShorthandAdditions.h

@@ -0,0 +1,57 @@
+//
+//  UIView+MASShorthandAdditions.h
+//  Masonry
+//
+//  Created by Jonas Budelmann on 22/07/13.
+//  Copyright (c) 2013 Jonas Budelmann. All rights reserved.
+//
+
+#import <UIKit/UIKit.h>
+#import "UIView+MASAdditions.h"
+
+#ifdef MAS_SHORTHAND
+
+@interface UIView (MASShorthandAdditions)
+
+@property (nonatomic, strong, readonly) MASViewAttribute *left;
+@property (nonatomic, strong, readonly) MASViewAttribute *top;
+@property (nonatomic, strong, readonly) MASViewAttribute *right;
+@property (nonatomic, strong, readonly) MASViewAttribute *bottom;
+@property (nonatomic, strong, readonly) MASViewAttribute *leading;
+@property (nonatomic, strong, readonly) MASViewAttribute *trailing;
+@property (nonatomic, strong, readonly) MASViewAttribute *width;
+@property (nonatomic, strong, readonly) MASViewAttribute *height;
+@property (nonatomic, strong, readonly) MASViewAttribute *centerX;
+@property (nonatomic, strong, readonly) MASViewAttribute *centerY;
+@property (nonatomic, strong, readonly) MASViewAttribute *baseline;
+
+- (void)buildConstraints:(void(^)(MASConstraintBuilder *constraints))block;
+
+@end
+
+#define MAS_ATTR_FORWARD(attr)  \
+- (MASViewAttribute *)attr {    \
+    return [self mas_##attr];   \
+}
+
+@implementation UIView (MASShorthandAdditions)
+
+MAS_ATTR_FORWARD(top);
+MAS_ATTR_FORWARD(left);
+MAS_ATTR_FORWARD(bottom);
+MAS_ATTR_FORWARD(right);
+MAS_ATTR_FORWARD(leading);
+MAS_ATTR_FORWARD(trailing);
+MAS_ATTR_FORWARD(width);
+MAS_ATTR_FORWARD(height);
+MAS_ATTR_FORWARD(centerX);
+MAS_ATTR_FORWARD(centerY);
+MAS_ATTR_FORWARD(baseline);
+
+- (void)buildConstraints:(void(^)(MASConstraintBuilder *constraints))block {
+    [self mas_buildConstraints:block];
+}
+
+@end
+
+#endif

+ 7 - 0
MasonryExamples/MasonryExamples.xcodeproj/project.xcworkspace/contents.xcworkspacedata

@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<Workspace
+   version = "1.0">
+   <FileRef
+      location = "self:MasonryExamples.xcodeproj">
+   </FileRef>
+</Workspace>