Skip to content

Instantly share code, notes, and snippets.

@M4cs
Created February 17, 2019 08:30
Show Gist options
  • Save M4cs/2934c019125207542acb65dd7f31ffba to your computer and use it in GitHub Desktop.
Save M4cs/2934c019125207542acb65dd7f31ffba to your computer and use it in GitHub Desktop.
%hook UIWindow
-(void)layoutSubviews {
%orig;
[self setClipsToBounds:YES];
[self.layer setCornerRadius:25.0f];
CAGradientLayer *gradient = [CAGradientLayer layer];
CAShapeLayer *shapeLayer = [[CAShapeLayer alloc] init];
self.layer.cornerRadius = 25.0f;
self.layer.shadowColor = [UIColor blueColor].CGColor;
self.layer.shadowRadius = 10.0f;
self.layer.shadowOpacity = 1.0f;
self.layer.shadowOffset = CGSizeMake(0, 0);
self.userInteractionEnabled = false;
gradient.frame = borderWindow.bounds;
gradient.colors = @[ (id)[UIColor blueColor].CGColor, (id)[UIColor redColor].CGColor ];
gradient.startPoint = CGPointMake(0.0, 0.0);
gradient.endPoint = CGPointMake(1, 1);
shapeLayer.lineWidth = 4.50f;
shapeLayer.path = [UIBezierPath bezierPathWithRoundedRect:self.bounds
cornerRadius:25.0f].CGPath;
shapeLayer.fillColor = nil;
shapeLayer.strokeColor = [UIColor blackColor].CGColor;
shapeLayer.cornerRadius = 25.0f;
gradient.mask = shapeLayer;
[borderWindow.layer insertSublayer:gradient atIndex:0];
}
%end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment