Solid Shadow in All Directions
where the light blue is the layer—the
UIImageView in this instance—and the dark blue is the shadow.
I’d like the shadow to do things:
- Appear on all four sides: accomplished by setting
CGSizeMake(0.0, 0.0)and making
- Be entirely opaque: accomplished by setting
shadowOffsetto a specific point in the layer and
I already have
shadowOpacityset to zero, but I can’t find a way to do both of these. For example, if I have:
imageView.layer.shadowColor = UIColor.orangeColor().CGColor imageView.layer.shadowOffset = CGSizeMake(4.0 , 4.0) imageView.layer.shadowOpacity = 1; imageView.layer.shadowRadius = 0 imageView.layer.masksToBounds = false
I get a solid shadow on two sides. If I want the shadow to be on all four sides, I change
shadowOffset to a specific size and
shadowRadius to something greater than zero, but then it’s not solid.
- Refresh UIPageViewController - reorder pages and add new pages
- Adjust View for keyboard appears when switching UITextField (Swift)
- Facebook login fails (always isCancelled) after upgrading to SDK 4.1
- Multiple HTML5 media elements on one page in iOS (iPad)
- How to cancel previous animation when a new one is triggered?
- iOS: Cropping a still image grabbed from a UIImagePickerController camera with overlay
Solutions Collect From Internet About “Solid Shadow in All Directions”
An alternative option is to use
borderColor. Keep in mind that, as mentioned in the docs, borders are drawn inside the layer bounds, rather than extending outside, so you may need to adjust its size as appropriate.
(Depending on your use case, you might consider using UIImageView with insets to make a stretchable image, which may have different performance characteristics if your layer is being resized.)
- shouldReceiveTouch on UITableViewCellContentView
- Sorting NSArray containing NSDate objects
- “Tap To Resume” Pause text SpriteKit
- PAN with Linux, iOS, Bluetooth, Bonjour, GameKit — Possible?
- Library for both iOS and OS X apps?
- Reducing iOS App file size
- .gitignore for Xcode Project
- NSMutableArray thread safety
- Localization of strings in static lib
- Use default back button in navigation controller
- When do I use CFRelease?
- MPMoviePlayerController switching movies causes white flash
- While scrolling on an iOS device, the z-index of elements isn't working
- Subclassing SKShapeNode with Swift