cagradientlayer

CAGradientLayer properties not animating within UIView animation block

早过忘川 提交于 2019-12-18 13:11:32
问题 I have a feeling I'm overlooking something elementary, but what better way to find it than to be wrong on the internet? I have a fairly basic UI. The view for my UIViewController is a subclass whose +layerClass is CAGradientLayer . Depending on the user's actions, I need to move some UI elements around, and change the values of the background's gradient. The code looks something like this: [UIView animateWithDuration:0.3 animations:^{ self.subview1.frame = CGRectMake(...); self.subview2.frame

Draw CAGradient within MKPolyLineView

烂漫一生 提交于 2019-12-18 12:46:01
问题 i have just a problem with my MKPolyLineView. I simply try to make a color gradient to the Polyline, but with CAGradient it doenst work. I subclasses MKPolylineView and redrawing in - (void)drawMapRect:(MKMapRect)mapRect zoomScale:(MKZoomScale)zoomScale inContext:(CGContextRef)context UIColor *darker = [UIColor blackColor]; CGFloat baseWidth = self.lineWidth / zoomScale; // draw the dark colour thicker CGContextAddPath(context, self.path); CGContextSetStrokeColorWithColor(context, darker

UIView transparent gradient

强颜欢笑 提交于 2019-12-18 10:05:43
问题 Given an arbitrary UIView on iOS, is there a way using Core Graphics (CAGradientLayer comes to mind) to apply a "foreground-transparent" gradient to it? I can't use a standard CAGradientLayer because the background is more complex than a UIColor. I also can't overlay a PNG because the background will change as my subview is scrolled along its parent vertical scrollview (see image). I have a non-elegant fallback: have my uiview clip its subviews and move a pre-rendered gradient png of the

Making a gradient arc?

折月煮酒 提交于 2019-12-17 20:32:57
问题 i wanna make an arc with the use of CAGradientLayer in such a way:- 20% of the arc have same single color then other 80% of arc has a gradient of two colors. I already tried by hand on locations startPoint endPoint property of CAGradientLayer but couldn't get the success and already go through from tutorials but somehow couldn't understand the concept properly.please solve my problem with clear description of it. // for beizier path - (UIBezierPath *)samplePath { UIBezierPath *path =

CAGradientLayer, not resizing nicely, tearing on rotation

不打扰是莪最后的温柔 提交于 2019-12-17 03:51:10
问题 I'm trying to get my CAGradientLayers, that i'm using to create nice gradient backgrounds, to resize nicely on rotation and modal view presentation, but they will not play ball. Here is a video I just created showing my problem: Notice the tearing on rotation. Also please note this video was created by filming the iPhone Simulator on OS X. I have slowed down the animations in the video to highlight my issue. Video of Problem... Here is an Xcode project which I just created (which is the

Gradient effect on some portion of UIImageView

笑着哭i 提交于 2019-12-13 07:23:00
问题 I have a requirements of adding gradient over some portion (only in left and right side ) of UIImageView. I know, this can be done by using CAGradientLayer(). But I am confused with properties locations and colors. Below is my code. It is adding gradient at top and bottom. if let containerView = imageView.superView { let gradient = CAGradientLayer(layer: containerView.layer) gradient.frame = containerView.bounds gradient.colors = [UIColor.clear.cgColor, UIColor.blue.cgColor ,UIColor.blue

CAGradient layer not visible on view

我是研究僧i 提交于 2019-12-12 21:01:02
问题 I try to add a CAGradient effect in a pie chart I make with Core Graphics. It turns out I am not able and certainly not understand very well how to apply it to a view that is part of a CGPath... override func draw(_ rect: CGRect) { ... func arc(myRadius: CGFloat, myStartAngle: CGFloat, myEndAngle: CGFloat) { // This is the pie chart segment context?.setFillColor(phenotypeColor.cgColor) context?.move(to: center) context?.addArc(center: center, radius: finalRadius, startAngle: myStartAngle,

How to change color of CAGradientLayer like screensaver?

旧时模样 提交于 2019-12-12 12:11:17
问题 I was created UIView with applying CAGradientLayer color effect as i attached Image Bellow. Now in this i want to change it's gradient color change top to bottom side smoothly like screensaver. I have Been tried using NStimer that bit Done but its changing color in CAGradientLayer look like jerk. For above I have use Bellow method of Code:- Timer = [NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(TIMER) userInfo:nil repeats:NO]; -(void)TIMER { Count++; [view_Color1

Applying CAGradient mask layer to UITextView

跟風遠走 提交于 2019-12-12 07:18:22
问题 I've got a UITextView, with scrollable text. I'm trying to apply a gradient layer to it, so the bottom of the visible text is always slightly faded out. Here's my code: CAGradientLayer *maskLayer = [CAGradientLayer layer]; maskLayer.colors = [NSArray arrayWithObjects:(id)[[UIColor clearColor] CGColor], (id)[[UIColor yellowColor] CGColor], nil]; maskLayer.locations = [NSArray arrayWithObjects:[NSNumber numberWithFloat:0.0], [NSNumber numberWithFloat:0.2], [NSNumber numberWithFloat:0.8],

iOS10 + Gradient stop working [duplicate]

梦想与她 提交于 2019-12-12 04:31:56
问题 This question already has an answer here : Can't set CALayer's border color (1 answer) Closed 3 years ago . Just been moved to Xcode8 and iOS10, providing support for iOS10 to one of the application. Figure out weird issue, suddenly Gradient is not working. I found that after applying Storyboard (Storyboard changes in Xcode8) changes gradient not visible to views. Xcode 7.3 - Gradient Views - Xcode 8 - Gradient Views - Also, If I replace Storyboard with old storyboard it shows gradient, So