-
-
Save asendra/11105879 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
[subview updateFrame:^(CGPoint *origin, CGSize *size) { | |
origin->y = floor((CGRectGetHeight(self.bounds) - SubviewHeight)/2); | |
}]; |
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
@interface UIView (Bryan) | |
- (void)updateFrame:(void (^)(CGPoint *origin, CGSize *size))block; | |
@end | |
@implementation UIView (Bryan) | |
- (void)updateFrame:(void (^)(CGPoint *origin, CGSize *size))block { | |
CGRect frame = self.frame; | |
CGPoint origin = frame.origin; | |
CGSize size = frame.size; | |
block(&origin, &size); | |
frame.origin = origin; | |
frame.size = size; | |
self.frame = frame; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment