Skip to content

Instantly share code, notes, and snippets.

View abrewing's full-sized avatar

Alondo Brewington abrewing

View GitHub Profile
@abrewing
abrewing / gist:9f77922515538f4085b9
Created September 30, 2014 16:27
Round only the corners that you want
UIBezierPath *maskPath;
maskPath = [UIBezierPath bezierPathWithRoundedRect:<#view#>.bounds
byRoundingCorners:(UIRectCornerTopLeft | UIRectCornerTopRight)
cornerRadii:CGSizeMake(<#width#>, <#height#>)];
CAShapeLayer *maskLayer = [[CAShapeLayer alloc] init];
maskLayer.frame = <#view#>.bounds;
maskLayer.path = maskPath.CGPath;
<#view#>.layer.mask = maskLayer;
@abrewing
abrewing / gist:8b523966e5b260eead1a
Created September 30, 2014 16:21
Remove all subviews from a view
for (UIView *view in [self subviews]){
if ([view isKindOfClass:[UIView class]]){
[view removeFromSuperview];
}
}
@abrewing
abrewing / gist:2e29c4250d6d26c4416f
Created September 30, 2014 16:20
Log the class name and method being called (shortcut -> nsl)
NSLog(@"%@ - %@", [[self class] description], NSStringFromSelector(_cmd));
@abrewing
abrewing / gist:56ec1623fc464294e02e
Created September 30, 2014 16:19
NSLog Error (shortcut -> nsle)
NSLog(@"%@ in: %@ - %@", [error description], [[self class] description], NSStringFromSelector(_cmd));