Created
February 20, 2014 03:02
-
-
Save semireg/9106368 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// NSView+ConstraintPack.m | |
// Sidebar Test 2 | |
// | |
// Created by Caylan Larson on 2/19/14. | |
// Copyright (c) 2014 Semireg Industries. All rights reserved. | |
// | |
#import "NSView+SemiConstraintPack.h" | |
#import "ConstraintPack.h" | |
@implementation NSView (SemiConstraintPack) | |
// Failsafes | |
-(void)constrainFailsafeSuperviewInset:(CGFloat)inset priority:(NSUInteger)priority; // ConstrainToSuperview | |
{ | |
ConstrainViewToSuperview(self, inset, priority); | |
} | |
// Constraining self | |
-(void)constrainToPoint:(CGPoint)point priority:(NSUInteger)priority; // PositionView | |
{ | |
PositionView(self, point, priority); | |
} | |
-(void)constrainToSize:(CGSize)size priority:(NSUInteger)priority; // SizeView | |
{ | |
SizeView(self, size, priority); | |
} | |
-(void)constrainMinimumSize:(CGSize)size priority:(NSUInteger)priority; // ConstrainMinimumViewSize | |
{ | |
ConstrainMinimumViewSize(self, size, priority); | |
} | |
-(void)setDualAxisContentHuggingPriority:(NSLayoutPriority)priority; // SetHuggingPriority | |
{ | |
SetHuggingPriority(self, priority); | |
} | |
-(void)setDualAxisContentCompressionResistancePriority:(NSLayoutPriority)priority; // SetResistancePriority | |
{ | |
SetResistancePriority(self, priority); | |
} | |
// Constrain to Supeview | |
-(void)constrainToSuperviewAxisWithInset:(CGSize)inset | |
priority:(NSUInteger)priority // StretchViewToSuperview | |
{ | |
StretchViewToSuperview(self, inset, priority); | |
} | |
-(void)constrainToSuperviewCenteredHorizontally:(BOOL)hAxis // CenterViewInSuperview | |
vertically:(BOOL)vAxis | |
priority:(NSUInteger)priority | |
{ | |
CenterViewInSuperview(self, hAxis, vAxis, priority); | |
} | |
// Constrain to View | |
-(void)constrainToView:(NSView*)anotherView // AlignViews | |
aligned:(NSLayoutAttribute*)layoutAttribute | |
priority:(NSUInteger)priority | |
{ | |
} | |
// Constrain Using Format | |
+(void)constrainWithFormat:(NSString*)formatString | |
bindingDictOfViews:(NSDictionary*)bindingDict | |
priority:(NSUInteger)priority | |
{ | |
ConstrainViewsWithBinding(formatString, bindingDict, priority); | |
} | |
// Testing inline binding... | |
//-(void)constrainWithPriority:(NSUInteger)priority | |
// format:(NSString*)formatString | |
// views:(NSView*)view1,...; | |
//{ | |
// NSMutableArray *arguments=[[NSMutableArray alloc]initWithArray:nil]; | |
// id eachObject; | |
// va_list argumentList; | |
// if (view1) | |
// { | |
// [arguments addObject: view1]; | |
// va_start(argumentList, view1); | |
// while ((eachObject = va_arg(argumentList, id))) | |
// { | |
// [arguments addObject: eachObject]; | |
// } | |
// va_end(argumentList); | |
// } | |
// NSLog(@"%@",arguments); | |
//} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment