Skip to content

Instantly share code, notes, and snippets.

@hiddenmemory
Created May 16, 2012 18:54
Show Gist options
  • Save hiddenmemory/2712991 to your computer and use it in GitHub Desktop.
Save hiddenmemory/2712991 to your computer and use it in GitHub Desktop.
ResourceHelper - applyBorderOffset
#import <UIKit/UIKit.h>
@interface UIView (ResourceHelper)
- (void)rh_applyBorderOffset:(CGRect)offset;
@end
#import "UIView+ResourceHelper.h"
@implementation UIView (ResourceHelper)
- (void)rh_applyBorderOffset:(CGRect)offset {
CGRect originalFrame = self.frame;
originalFrame.origin.x -= offset.origin.x;
originalFrame.origin.y -= offset.origin.y;
originalFrame.size.width += (offset.size.width * 2);
originalFrame.size.height += (offset.size.height * 2);
self.frame = originalFrame;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment