Bordered UITextView

#import <QuartzCore/QuartzCore.h> …. // typically inside of the -(void) viewDidLoad method self.yourUITextView.layer.borderWidth = 5.0f; self.yourUITextView.layer.borderColor = [[UIColor grayColor] CGColor];

CALayer with transparent hole in it

I was able to solve this with Jon Steinmetz suggestion. If any one cares, here’s the final solution: int radius = myRect.size.width; UIBezierPath *path = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, self.mapView.bounds.size.width, self.mapView.bounds.size.height) cornerRadius:0]; UIBezierPath *circlePath = [UIBezierPath bezierPathWithRoundedRect:CGRectMake(0, 0, 2.0*radius, 2.0*radius) cornerRadius:radius]; [path appendPath:circlePath]; [path setUsesEvenOddFillRule:YES]; CAShapeLayer *fillLayer = [CAShapeLayer layer]; fillLayer.path = path.CGPath; fillLayer.fillRule = kCAFillRuleEvenOdd; … Read more

iOS: what’s the fastest, most performant way to make a screenshot programmatically?

I’ve found a better method that uses the snapshot API whenever possible. I hope it helps. class func screenshot() -> UIImage { var imageSize = CGSize.zero let orientation = UIApplication.shared.statusBarOrientation if UIInterfaceOrientationIsPortrait(orientation) { imageSize = UIScreen.main.bounds.size } else { imageSize = CGSize(width: UIScreen.main.bounds.size.height, height: UIScreen.main.bounds.size.width) } UIGraphicsBeginImageContextWithOptions(imageSize, false, 0) for window in UIApplication.shared.windows { window.drawHierarchy(in: … Read more