Questions tagged [cagradientlayer]

`CAGradientLayer` is a special purpose `CALayer` subclass for drawing animatable linear gradients. It's a part of the QuartzCore framework and is available for both iOS (since iOS 3.0) and OS X (since OS X v10.6 "Snow Leopard"). The gradient is specified using four properties for the `colors`, their `locations` and the `startPoint` and `endPoint` of the layer. All four properties are animatable.

CAGradientLayer is a special purpose CALayer subclass for drawing animatable linear gradients. It's a part of the framework and is available for both (since iOS 3.0) and (since OS X v10.6 "Snow Leopard").

The gradient is specified using four properties for the colors, their locations and the startPoint and endPoint of the layer. All four properties are animatable.

The colors is an NSArray of CGColorRef objects therefore they need to be cast to ids when adding them to the array.

The locations, startPoint and endPoint are specified in the unit coordinate space of the layers bounds. This means that the values go from 1.0 to 0.0. In both iOS and OS X, x increases to the right which means that 0.0 is the left edge and 1.0 is the right edge. On iOS y increases downward and on OS X y increases upwards.

405 questions
0
votes
1 answer

Adding Gradient Hides UILabel Text In UITableViewCell

I am trying to add gradient layer behind the UILabel's text which resides in a custom UITableViewCell. Problem is that gradient is hiding my label's text. I have already visited this link, but it is not working for me.So how can I add it behind the…
NightFury
  • 13,436
  • 6
  • 71
  • 120
0
votes
1 answer

CALayer issues with QuartzCore

I am using CAGradientLayer to style my uibuttons. Basically have three buttons in a cell. When I set CAGradientLayer properties on first, it works fine (I get a gradient). However, when I apply a CAGradientLayer to the second one, it does appear on…
Live2Enjoy7
  • 1,075
  • 2
  • 11
  • 22
0
votes
1 answer

Add CAGradient Layer behind UIImageView iOS

I am trying to add a gradient behind a transparent image. I do this on the map leftCallOutAccessoryView however no matter what I try the gradient layer always shows above the imageView and want it to appear behind it heres my code for…
Alex McPherson
  • 3,185
  • 3
  • 30
  • 41
0
votes
3 answers

Set Selected State of CAGradient UIButton in iOS

Hi I have made a custom button in code using corner radius CAGradientLayer and border colour in one of my view controllers like the below: phoneButton = [CustomButton buttonWithType:UIButtonTypeCustom]; phoneButton.frame = CGRectMake(6, 363, 99,…
Alex McPherson
  • 3,185
  • 3
  • 30
  • 41
0
votes
0 answers

how to set a shader color both from top to bottom and from left to right in a CAGradientLayer?

I want to draw a UiView's background use shader color.So I find the QuartzDemo.But I want to set the shader from white to red at horizontal and from white to black at vertical direction. What can I do that ??? Need you help.Thank you in Advance!
Domlin
  • 185
  • 1
  • 12
0
votes
1 answer

Custom cell sublayers and UITableViewCell selection

How can I make a custom sublayer in a UITableViewCell disappear in setSelected:animated:? Context: I've added a custom background layer to my UITableViewCell by adding a CAGradientLayer inside of drawRect:, like so: - (void)drawRect:(CGRect)rect{ …
Moshe
  • 57,511
  • 78
  • 272
  • 425
0
votes
1 answer

UIButton with a gradient layer slow

I am customizing the UIButton with GradientLayer. I see a performance issue as view loading slowly and looks like a Jerk effect. Also when changing the orientation its same. I am using this code for an iPad application. With normal UIButton its…
Srivathsa
  • 606
  • 10
  • 34
0
votes
2 answers

EXC_BAD_ACCESS on animationForKey:

I'm trying to use a recent feature of the Scintilla component, which provides OSX-like text-highlighting effect (the yellow animated bouncing box), and I'm stuck with an error that pops up intermittently : EXC_BAD_ACCESS pointing to this…
Dr.Kameleon
  • 22,532
  • 20
  • 115
  • 223
-1
votes
1 answer

CAGradientLayer not fit perfectly on UITableViewCell bounds

i am developing simple UITableView with custom UITableViewCell with Xib file i have added MainView and pin it to ContentView in order to add all my views inside MainView as shown below UITableViewCell layout when i try to add CAGradientLayer to…
Mamad
  • 71
  • 7
-1
votes
2 answers

UITextView gradient layer apply not working

I want to apply gradient layer on top 10% and bottom 10% of UITextView. To do this, I place a dummy UIView called container view and make UITextView a subview of it. And then I add the following code: if let containerView = textView.superview { …
Deepak Sharma
  • 5,577
  • 7
  • 55
  • 131
-1
votes
1 answer

label not showing after implement gradient color at view xcode

my labels don't show after I implement this gradient gradientLayer = CAGradientLayer() gradientLayer.frame = self.myview.bounds gradientLayer.colors = [UIColor.init(displayP3Red:0.04, green:0.47, blue:0.74, alpha:1.0).cgColor,…
dante
  • 5
  • 4
-1
votes
1 answer

iOS - Transition between gradients?

I'm trying to rotate the background colour endlessly between two different gradients, but the actual transition isn't lasting as long as expected (it lasts for less than a second and there's no delay between each transition). var backgroundColours =…
Adi219
  • 4,712
  • 2
  • 20
  • 43
-1
votes
2 answers

How can I apply CAGradientLayer to a UINavigationController background

I have a UINavigationController with prefersLargeTitles = true I'd like to apply a background colour to my nav bar, with a gradient mask so the colour essentially fades to a darker version. I have tried to create a UIView apply the mask and render…
Tim J
  • 1,211
  • 1
  • 14
  • 31
-1
votes
2 answers

Change the colors of CAGradientLayer with slider in realtime

I want to be able to change to change the colours of a CAGradientLayer in realtime with values i receive over @IBAction in the main ViewController. UISlider moves, color changes in background. I m asking for a theoretical approach. What is the…
cutcode
  • 3
  • 3
-1
votes
1 answer

How to add angle in gradient from UI?

I have this code to modify the colors from the interface : @IBDesignable class GradientView: UIView { @IBInspectable var firstColor: UIColor = UIColor.clear{ didSet{ updateView() } } @IBInspectable var…
Fulano
  • 71
  • 8
1 2 3
26
27