Created
October 25, 2012 09:21
-
-
Save isutton/3951591 to your computer and use it in GitHub Desktop.
UIWindow subclass that adds rounded top corners.
This file contains hidden or 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 MyWindow : UIWindow | |
@end |
This file contains hidden or 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
#import <QuartzCore/QuartzCore.h> | |
#import "MyWindow.h" | |
@implementation MyWindow | |
- (void)layoutSubviews | |
{ | |
[super layoutSubviews]; | |
CGRect frame = [UIScreen mainScreen].applicationFrame; | |
UIBezierPath *innerPath = [UIBezierPath bezierPathWithRoundedRect:frame byRoundingCorners:UIRectCornerTopLeft|UIRectCornerTopRight cornerRadii:CGSizeMake(5.0f, 5.0f)]; | |
CAShapeLayer *maskLayer = [CAShapeLayer layer]; | |
maskLayer.path = innerPath.CGPath; | |
self.layer.mask = maskLayer; | |
} | |
@end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment