布局类别
#define VFL(ARRAY,VIEWS) ([NSLayoutConstraint constraintsWithVisualFormatsArray:(ARRAY) views:(VIEWS)])
@interface NSLayoutConstraint (NSArray)
+ (NSArray *)constraintsWithVisualFormat:(NSString *)format views:(NSDictionary*)dicViews;
+ (NSArray *)constraintsWithVisualFormatsArray:(NSArray *)aryFormats views:(NSDictionary*)dicViews;
@end
#import "NSLayoutConstraint+NSArray.h"
@implementation NSLayoutConstraint (NSArray)
+ (NSArray *)constraintsWithVisualFormat:(NSString *)format views:(NSDictionary*)dicViews
{
return [self constraintsWithVisualFormat:format options:0 metrics:nil views:dicViews];
}
+(NSArray*)constraintsWithVisualFormatsArray:(NSArray *)aryFormats views:(NSDictionary *)dicViews
{
NSMutableArray* ary=[[NSMutableArray alloc] init];
for (NSString* strVFL in aryFormats) {
[ary addObjectsFromArray:[self constraintsWithVisualFormat:strVFL views:dicViews]];
}
return ary;
}
@end