quartz-core

Create shadow using QuartzCore for UITextView [duplicate]

回眸只為那壹抹淺笑 提交于 2019-12-05 02:44:26
问题 This question already has answers here : Why masksToBounds = YES prevents CALayer shadow? (6 answers) Closed 2 years ago . I have created a shadow using QuartzCore for my UITextView with this following code. myTextView.layer.masksToBounds = NO; myTextView.layer.shadowColor = [UIColor blackColor].CGColor; myTextView.layer.shadowOpacity = 0.7f; myTextView.layer.shadowOffset = CGSizeMake(2.0f, 2.0f); myTextView.layer.shadowRadius = 8.0f; myTextView.layer.shouldRasterize = YES; It creates a

ios - Drawing Brush from finger toches moves

女生的网名这么多〃 提交于 2019-12-05 01:23:34
问题 i want to draw in my iPad app as in the following image in my app i have placed a image and while moving the finger(touch movement) i am repeating the images, but my image seems to be as follows. Following is my code to draw the image CGBlendMode blendMode = kCGBlendModeColorDodge; UIGraphicsBeginImageContext(drawImage.frame.size); [drawImage.image drawInRect:CGRectMake(0, 0, drawImage.frame.size.width, drawImage.frame.size.height)]; CGContextSetLineCap(UIGraphicsGetCurrentContext(),

Is Rounded Corners on Attributed Text Background possible?

依然范特西╮ 提交于 2019-12-05 00:21:40
问题 I attributed Text with different textcolors. For better readability on highlighted text i use backgroundcolor. Is it possible to bring the CALayer Effect of Rounded Corners on this Textarea? Not the whole Area but the special Text inside of it. My Code: NSAttributedString *text = [[NSAttributedString alloc] initWithString:@"Highlighted Text" attributes:@{ NSFontAttributeName: [UIFont fontWithName:@"HelveticaNeue" size:10.0f], NSForegroundColorAttributeName: [UIColor lightGrayColor],

Glass effects UIView

感情迁移 提交于 2019-12-04 17:07:11
I would like to know how it is possible to add a glass effect on a UIView I would like something like this effects on the gray translucent view you can see here : Thanks There's nothing like glass effect in UIView .All you can do is set the opacity of the view between 0 and 1.Also the view shown above has fine set of images which makes it seem like your "Glass Effect". Well If you what your UIView to be "shiny and elegant" , you can do it in two ways :- 1>You can simply have effects in images created with photoshop as it will decrease the overhead of doing the same with programming. 2>you can

How to draw Arc with curved edge in iOS?

南笙酒味 提交于 2019-12-04 14:01:42
In one of my application, I am trying to draw a gradient arc with rounded edges. Like the following image. This is what I have done so far using the following code. -(void)startArc { UIBezierPath *roundedArc = [self arcWithRoundedCornerAt:centerPoint startAngle:DEGREES_TO_RADIANS(-90) endAngle:DEGREES_TO_RADIANS(90) innerRadius:width-20 outerRadius:width cornerRadius:0]; CAShapeLayer *mask = [CAShapeLayer new]; [mask setPath:roundedArc.CGPath]; [mask setFrame:_outerView.bounds]; [mask setShouldRasterize:YES]; [mask setRasterizationScale:[UIScreen mainScreen].scale]; CAGradientLayer *gradient =

Is there an alternative to CGPath which allows to compute points on a path for a given location?

。_饼干妹妹 提交于 2019-12-04 13:17:51
For an animation timing algorithm I need to supply a path as the curve. Probably a bezier curve with control points on both ends. The problem is that it seems not possible to calculate points on a CGPath because CGPathRef is opaque. Also Apple provides no mechanism to compute points on a path. Is there a library or utility class which can compute points on a bezier curve or path, for a given location like 0.5 for the middle along the path? Or let me rephrase it: If CGPath / CGPathRef makes this impossible because it is opaque, and if you only care about bezier curves, is there a way to compute

About UIImageView with round corners

不羁的心 提交于 2019-12-04 06:17:47
问题 I'm trying to make a UIImageView with round corners, so I used [imageView.layer setCornerRadius:5.0f]; it works but not perfectly. If you look closely, you can see the corners of the image(I uploaded a photo, I don't know if you can see it clearly, there are blue parts in the corners). How should I remove these? thank you. (P.S.: I also set the border of the view, is that the reason why?) 回答1: UIImageView doesn't clip to bounds by default. So while the corner radius is applied its still

CAShapeLayer animation (arc from 0 to final size)

萝らか妹 提交于 2019-12-03 17:43:19
问题 I have a CAShapeLayer in which an arc is added using UIBezierPath . I saw a couple of posts (one actually) here on stackoverflow but none seemed to give me the answer. As said in the title I would like to animate an arc (yes it will be for a pie chart). How can one accomplish an animation from an "empty" arc to the fully extended one? Kinda like a curved progress bar. Is it really impossible to do it via CoreAnimation ? Here's how I "do" the arc. Oh and ignore the comments and calculation

Create shadow using QuartzCore for UITextView [duplicate]

雨燕双飞 提交于 2019-12-03 17:17:58
This question already has an answer here: Why masksToBounds = YES prevents CALayer shadow? 6 answers I have created a shadow using QuartzCore for my UITextView with this following code. myTextView.layer.masksToBounds = NO; myTextView.layer.shadowColor = [UIColor blackColor].CGColor; myTextView.layer.shadowOpacity = 0.7f; myTextView.layer.shadowOffset = CGSizeMake(2.0f, 2.0f); myTextView.layer.shadowRadius = 8.0f; myTextView.layer.shouldRasterize = YES; It creates a shadow and looks good too. Here it is my output for the above code. But When I try to add a text to the myTextView , my textView

ios - Drawing Brush from finger toches moves

匆匆过客 提交于 2019-12-03 16:55:44
i want to draw in my iPad app as in the following image in my app i have placed a image and while moving the finger(touch movement) i am repeating the images, but my image seems to be as follows. Following is my code to draw the image CGBlendMode blendMode = kCGBlendModeColorDodge; UIGraphicsBeginImageContext(drawImage.frame.size); [drawImage.image drawInRect:CGRectMake(0, 0, drawImage.frame.size.width, drawImage.frame.size.height)]; CGContextSetLineCap(UIGraphicsGetCurrentContext(), kCGLineCapRound); //// NSString *imagePath = [[NSBundle mainBundle] pathForResource:@"Watercolor-edge-45x45.png