Questions tagged [shadowpath]

10 questions
3
votes
1 answer

Is there a way to get the shadowPath for a UILabel text?

I'm currently using a UILabel to display some text. I'm using CALayer to give it a nice shadow. But: performance is really bad when I'm positioning (and moving) a lot of UILabel elements on the screen. I've read in a few blogposts that setting the…
polyclick
  • 2,704
  • 4
  • 32
  • 58
2
votes
3 answers

UIView's shadowpath color doesn't change

I have a UIView and I set a shadowPath for it like this: func addShadow() { let cornerRadius: CGFloat = self.containerView.frame.height/2 self.containerView.layer.shadowPath = UIBezierPath(roundedRect: self.containerView.frame, cornerRadius:…
Arash Etemad
  • 1,827
  • 1
  • 13
  • 29
1
vote
0 answers

Create a bezier path using an image's transparency, use for CALayer's shadowPath

Is there an easy way to use an image's transparency to create a bezier path? I'm trying to optimize an animation of a number of CALayers. But I get huge slowdowns when I add a drop shadow using the built in CALayer shadowColor, shadowOffset,…
Kenny Winker
  • 11,919
  • 7
  • 56
  • 78
1
vote
1 answer

UIView with Gradient and shadow

Trying to add a gradient, add round corner and add shadow on a UIView. I can get it to work, but the gradient was not properly located. (should replace all the red) let gradientLayer = CAGradientLayer() gradientLayer.colors = [UIColor(red: 0.333,…
Franck
  • 8,939
  • 8
  • 39
  • 57
1
vote
0 answers

Swift: TableViewCell unexpected shadow behaviour

I am trying to create a table view with expandable cells. The cells also have an offset from both sides by a few pixels and a shadowPath set as well. Example gif which I am referring to. The first problem is that the shadowPaths are not getting…
David
  • 2,109
  • 1
  • 22
  • 27
1
vote
3 answers

Shadow on UITableViewCell is giving bad performance

I'm creating table view with custom cells, which looks like news feed - on gray background there are rectangles with rounded corners and shadow. While cellForRowAtIndexPath method is calling I'm setting shadow like…
user5762284
1
vote
1 answer

UIImageview shadowpath

I've noticed that when you set the shadowpath on UIImageView's layer property, it kills the image quality. Can someone tell me why that happens and what the correct way of doing it is? imageView.layer.shouldRasterize = YES; …
audiophilic
  • 93
  • 1
  • 3
  • 8
0
votes
1 answer

Inner shadow for partial arc with Swift

I want to create an inner shadow for an arc but I get half of a circle instead of the shadow (see image below). My code is: let rect = self.bounds let segmentArcPath = UIBezierPath() segmentArcPath.addArc(withCenter: rect.center, …
Hans Bondoka
  • 437
  • 1
  • 4
  • 14
0
votes
3 answers

Adding shadow to tableview cell cause laggy scroll and duplicate shadow

I have added white space around my tableview cell and every time I scroll this shadows getting bigger and bigger when I scroll, and its get lag when I scroll for the second and third time with the bigger shadow override func tableView(_ tableView:…
UncleJunior
  • 231
  • 1
  • 2
  • 12
-2
votes
1 answer

Adding shadow to subview interfer with parent view (iOS swift)

Any idea on how to achieve this shadow effect ? This screen is from the android app I am using swift (ios) note that I have two views and when I add shadow to both they interfer and get darker