Skip to content

Instantly share code, notes, and snippets.

@semireg
Last active August 29, 2015 13:56
Show Gist options
  • Select an option

  • Save semireg/9105180 to your computer and use it in GitHub Desktop.

Select an option

Save semireg/9105180 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 (ConstraintPack)
-(void)prepareForAutoLayout; // PrepareViewForAutoLayout
-(NSView*)nearestCommonViewAncestorWithView:(NSView*)view; // NearestCommonViewAncestor
-(NSArray*)externalConstraints; // ExternalConstraintsReferencingView
-(NSArray*)internalConstraints; // InternalConstraintsReferencingView
-(NSArray*)referencingConstraints; // ConstraintsReferencingView
// Failsafes
-(void)constrainFailsafeSuperviewInset:(CGFloat)inset priority:(NSUInteger)priority; // ConstrainToSuperview
-(void)constrainFailsafeSize:(CGSize)size priority:(NSUInteger)priority; // ConstrainMinimumViewSize
// Just the view
-(void)constrainToPoint:(CGPoint)point priority:(NSUInteger)priority; // PositionView
-(void)constrainToSize:(CGSize)size priority:(NSUInteger)priority; // SizeView
-(void)setDualAxisContentHuggingPriority:(NSLayoutPriority)priority; // SetHuggingPriority
-(void)setDualAxisContentCompressionResistancePriority:(NSLayoutPriority)priority; // SetResistancePriority
// With respect to Supeview
-(void)constrainToSuperviewAxisWithInset:(CGSize)inset priority:(NSUInteger)priority; // StretchViewToSuperview
-(void)constrainToSuperviewCenteredHorizontally:(BOOL)hAxis // CenterViewInSuperview
vertically:(BOOL)vAxis
priority:(NSUInteger)priority;
// With respect to other views
-(void)constrainToView:(NSView*)anotherView // AlignViews
aligned:(NSLayoutAttribute*)layoutAttribute
priority:(NSUInteger)priority;
// Visual formatters
-(void)constrainWithFormat:(NSString*)formatString priority:(NSUInteger)priority; // ConstrainViews
-(void)constrainWithFormat:(NSString*)formatString // ConstrainViewArray
views:(NSArray*)viewArray
priority:(NSUInteger)priority;
-(void)constrainWithFormat:(NSString*)formatString // ConstrainViewsWithBinding
bindings:(NSDictionary*)bindings
priority:(NSUInteger)priority;
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment