UIView with a Dashed line

Check UIBezierPath setLineDash:count:phase: method: – (void)setLineDash:(const CGFloat *)pattern count:(NSInteger)count phase:(CGFloat)phase` method. This allows you to draw dashed lines. First add a CAShapeLayer. Add it as sublayer to your UIView. It has a path property. Now make an object of UIBezierPath. Draw the line using setLineDash. For example: UIBezierPath *path = [UIBezierPath bezierPath]; //draw a line … Read more

Most efficient way to draw part of an image in iOS

I guessed you are doing this to display part of an image on the screen, because you mentioned UIImageView. And optimization problems always need defining specifically. Trust Apple for Regular UI stuff Actually, UIImageView with clipsToBounds is one of the fastest/simplest ways to archive your goal if your goal is just clipping a rectangular region … Read more

What’s the difference between Quartz Core, Core Graphics and Quartz 2D?

Quartz 2D is an API of the Core Graphics framework that implements drawing. Quartz Core is a framework that includes APIs for animation and image processing. Quartz frameworks and their APIs CoreGraphics.framework Quartz 2D API manages the graphic context and implements drawing. Quartz Services API provides low level access to the window server. This includes … Read more

How to map atan2() to degrees 0-360

Solution using Modulo A simple solution that catches all cases. degrees = (degrees + 360) % 360; // +360 for implementations where mod returns negative numbers Explanation Positive: 1 to 180 If you mod any positive number between 1 and 180 by 360, you will get the exact same number you put in. Mod here … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)