Skip to content

Instantly share code, notes, and snippets.

@semireg
Created February 20, 2014 03:01
Show Gist options
  • Save semireg/9106356 to your computer and use it in GitHub Desktop.
Save semireg/9106356 to your computer and use it in GitHub Desktop.
//
// NSView+ConstraintPack.h
// Sidebar Test 2
//
// Created by Caylan Larson on 2/19/14.
// Copyright (c) 2014 Semireg Industries. All rights reserved.
//
#import <Cocoa/Cocoa.h>
@interface NSView (SemiConstraintPack)
// Failsafes
-(void)constrainFailsafeSuperviewInset:(CGFloat)inset priority:(NSUInteger)priority; // ConstrainToSuperview
// Constraining self
-(void)constrainToPoint:(CGPoint)point priority:(NSUInteger)priority; // PositionView
-(void)constrainToSize:(CGSize)size priority:(NSUInteger)priority; // SizeView
-(void)constrainMinimumSize:(CGSize)size priority:(NSUInteger)priority; // ConstrainMinimumViewSize
-(void)setDualAxisContentHuggingPriority:(NSLayoutPriority)priority; // SetHuggingPriority
-(void)setDualAxisContentCompressionResistancePriority:(NSLayoutPriority)priority; // SetResistancePriority
// Constrain to Supeview
-(void)constrainToSuperviewAxisWithInset:(CGSize)inset priority:(NSUInteger)priority; // StretchViewToSuperview
-(void)constrainToSuperviewCenteredHorizontally:(BOOL)hAxis // CenterViewInSuperview
vertically:(BOOL)vAxis
priority:(NSUInteger)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;
//-(void)constrainWithPriority:(NSUInteger)priority
// format:(NSString*)formatString
// views:(NSView*)view1,...;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment