quartz-core

Apply gradient on a UIView not working

五迷三道 提交于 2020-05-26 05:04:34
问题 I am trying to add gradient to a UIView programmatically but it is not working. It just appears to have no color at all. I have attached the relevant code as well as a screenshot. Notice the bottom square over which i am applying the gradient. Can someone help me figure out what I'm doing wrong here? let sundayView = UIView() override func viewDidLoad() { super.viewDidLoad() setupViews() setupSundayView() } func setupViews() { sundayView.translatesAutoresizingMaskIntoConstraints = false view

How to highlight, searched word in PDF reader?

天大地大妈咪最大 提交于 2020-01-14 03:25:30
问题 In PDF reading application is being developed and using QuartzCore (VFR) framework PDF reading is being achieved. Now what is needed to be implement is to highlight the text, which is being searched by the user. How to achieve it? NOTE: I have went through FAST PDF KIT , but been unable to get any thing. 回答1: Try using https://github.com/KurtCode/PDFKitten. 来源: https://stackoverflow.com/questions/6661933/how-to-highlight-searched-word-in-pdf-reader

How to draw stars using Quartz Core?

假如想象 提交于 2020-01-10 08:26:24
问题 I'm trying to adapt an example provided by Apple in order to programmatically draw stars in line, the code is the following: CGContextRef context = UIGraphicsGetCurrentContext(); CGContextSetLineWidth(context, aSize); for (NSUInteger i=0; i<stars; i++) { CGContextSetFillColorWithColor(context, aColor); CGContextSetStrokeColorWithColor(context, aColor); float w = item.size.width; double r = w / 2; double theta = 2 * M_PI * (2.0 / 5.0); // 144 degrees CGContextMoveToPoint(context, 0, r); for

Draw a line with a CALayer

こ雲淡風輕ζ 提交于 2020-01-09 19:31:07
问题 I'm trying to draw a line between two points using a CALayer. Here is my code: //positions a CALayer to be a line between a parent node and its subnodes. -(void)makeLineLayer:(CALayer *)layer lineFromPointA:(CGPoint)pointA toPointB:(CGPoint)pointB{ NSLog([NSString stringWithFormat:@"Coordinates: \n Ax: %f Ay: %f Bx: %f By: %f", pointA.x,pointA.y,pointB.x,pointB.y]); //find the length of the line: CGFloat length = sqrt((pointA.x - pointB.x) * (pointA.x - pointB.x) + (pointA.y - pointB.y) *

Draw a line with a CALayer

♀尐吖头ヾ 提交于 2020-01-09 19:27:07
问题 I'm trying to draw a line between two points using a CALayer. Here is my code: //positions a CALayer to be a line between a parent node and its subnodes. -(void)makeLineLayer:(CALayer *)layer lineFromPointA:(CGPoint)pointA toPointB:(CGPoint)pointB{ NSLog([NSString stringWithFormat:@"Coordinates: \n Ax: %f Ay: %f Bx: %f By: %f", pointA.x,pointA.y,pointB.x,pointB.y]); //find the length of the line: CGFloat length = sqrt((pointA.x - pointB.x) * (pointA.x - pointB.x) + (pointA.y - pointB.y) *

CALayer with transparent hole in it

六月ゝ 毕业季﹏ 提交于 2020-01-08 18:16:46
问题 I have a simple view (left side of the picture) and i need to create some kind of overlay (right side of the picture) to this view. This overlay should have some opacity, so the view bellow it is still partly visible. Most importantly this overlay should have a circular hole in the middle of it so it doesn't overlay the center of the view (see picture bellow). I can easily create a circle like this : int radius = 20; //whatever CAShapeLayer *circle = [CAShapeLayer layer]; circle.path =