Skip to content

Instantly share code, notes, and snippets.

@wilsolutions
Last active April 6, 2016 23:42
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save wilsolutions/33e63977652ffe83096b to your computer and use it in GitHub Desktop.
General Objective-C snippets to work around some iOS issues.
// Drawing a dotted line
float width = kBoundsWidth - 90;
CAShapeLayer *shapelayer = [CAShapeLayer layer];
UIBezierPath *path = [UIBezierPath bezierPath];
[path moveToPoint:CGPointMake(-30, 30)];
[path addLineToPoint:CGPointMake(width, 30)];
UIColor *fill = [UIColor lightGrayColor];
shapelayer.strokeStart = 0.0;
shapelayer.strokeColor = fill.CGColor;
shapelayer.lineWidth = 0.5;
shapelayer.lineJoin = kCALineJoinRound;
shapelayer.lineDashPattern = [NSArray arrayWithObjects:[NSNumber numberWithInt:1],[NSNumber numberWithInt:3 ], nil];
shapelayer.path = path.CGPath;
[self.cardNumber.layer addSublayer:shapelayer];
// Fliping image position inside UIButton
self.browseByDepartmentButton.transform = CGAffineTransformMakeScale(-1.0, 1.0);
self.browseByDepartmentButton.titleLabel.transform = CGAffineTransformMakeScale(-1.0, 1.0);
self.browseByDepartmentButton.imageView.transform = CGAffineTransformMakeScale(-1.0, 1.0);
// To change opaque modal views status bar
[[self navigationController] presentViewController:detailEditView animated:YES completion:^{
[[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault];
}];
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment