-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
92 additions
and
3 deletions.
There are no files selected for viewing
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
#import <UIKit/UIKit.h> | ||
|
||
/** A set of geometry convenience methods for UIView. | ||
*/ | ||
@interface UIView (BDKGeometry) | ||
|
||
/** Origin modification helper. | ||
* @param origin the origin to use. | ||
*/ | ||
- (void)setOrigin:(CGPoint)origin; | ||
|
||
/** X-origin modification helper. | ||
* @param xOrigin the x-origin to use. | ||
*/ | ||
- (void)setXOrigin:(CGFloat)xOrigin; | ||
|
||
/** Y-origin modification helper. | ||
* @param yOrigin the y-origin to use. | ||
*/ | ||
- (void)setYOrigin:(CGFloat)yOrigin; | ||
|
||
/** Size modification helper. | ||
* @param size the size to use. | ||
*/ | ||
- (void)setSize:(CGSize)size; | ||
|
||
/** Width modification helper. | ||
* @param width the width to use. | ||
*/ | ||
- (void)setWidth:(CGFloat)width; | ||
|
||
/** Height modification helper. | ||
* @param height the height to use. | ||
*/ | ||
- (void)setHeight:(CGFloat)height; | ||
|
||
/** Positions a view directly beneath another view. | ||
* @param view the view to position this view below. | ||
*/ | ||
- (void)positionViewBelowView:(UIView *)view; | ||
|
||
/** Positions a view directly beneath another view, with padding. | ||
* @param view the view to position this view below. | ||
* @param padding the padding to put between. | ||
*/ | ||
- (void)positionViewBelowView:(UIView *)view padding:(CGFloat)padding; | ||
|
||
@end |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#import "UIView+BDKGeometry.h" | ||
#import "BDKGeometry.h" | ||
|
||
@implementation UIView (BDKGeometry) | ||
|
||
- (void)setOrigin:(CGPoint)origin { | ||
self.frame = CGRectSetOrigin(self.frame, origin); | ||
} | ||
|
||
- (void)setXOrigin:(CGFloat)xOrigin { | ||
self.frame = CGRectSetXOrigin(self.frame, xOrigin); | ||
} | ||
|
||
- (void)setYOrigin:(CGFloat)yOrigin { | ||
self.frame = CGRectSetYOrigin(self.frame, yOrigin); | ||
} | ||
|
||
- (void)setSize:(CGSize)size { | ||
self.frame = CGRectSetSize(self.frame, size); | ||
} | ||
|
||
- (void)setWidth:(CGFloat)width { | ||
self.frame = CGRectSetWidth(self.frame, width); | ||
} | ||
|
||
- (void)setHeight:(CGFloat)height { | ||
self.frame = CGRectSetHeight(self.frame, height); | ||
} | ||
|
||
- (void)positionViewBelowView:(UIView *)view { | ||
[self positionViewBelowView:view padding:0]; | ||
} | ||
|
||
- (void)positionViewBelowView:(UIView *)view padding:(CGFloat)padding { | ||
[self setYOrigin:CGRectGetMaxY(view.frame) + padding]; | ||
} | ||
|
||
@end |