Multi-colored Shadow Swift - ios

In the iOS music app, I've noticed the shadow underneath album artwork changes based on the color of the artwork. This shadow can also be multi-colored based on how the color at the edge of the artwork changes.
Does anyone know how to recreate this effect programmatically?

Thanks to #Josh Homann for pointing me in the right direction, but the answer was actually much more complex.
The first (bottom) UIView in the hierarchy should have a plain white background and be pinned to the edges of the screen.
The next view should be a UIImageView with an alpha of 0.75.
Then you should add a UIVisualEffectView with the same dimensions as the first view.
Finally, add another UIImageView that is the same size as the first UIImageView.
Your IB hierarchy should look similar to this:
The final result is this:

Its not a shadow its a UIVisualEffectView with a blur. Add a second image view under your image view with a larger size and add a blurring visualEffectView to it.

Sorry to revive an old question, but this library nailed it: ShadowImageView.
It uses CIFilter which gives you more control over the blur effect and better results.

Related

How do I take in image view in iOS and make it go behind the other layers to make it the background?

There isn't really code for this it's more on the story board.
I have tried to go to the attributes and size modifier but I can't find anything that makes the UIImageView the background.
Just Drag the uiimageview in the left side, and drop it to the top of the other component.
Just set an image as the backgroundColor, something like:
self.view.backgroundColor = UIColor(patternImage: image)
See: https://developer.apple.com/reference/uikit/uicolor for more details.

Creating transparent UIView with subtle blur effect

So I'm trying to replicate a UIView with a subtle transparent blur effect as shown in the wires above. I feel like I've tried everything...UIBlurEffectViews are too intense, I've tried a few 3rd party library's such as ILTranslucentView and FXBlurView that don't do the trick, I feel a bit hopeless. The idea is that the blurry transparent view will act as a slider view on top of another view. When the user pulls the slider view on top of it's parent view, the parent view will blur. If anyone could point me in the right direction I would really appreciate it.
To change the "subtlety" of the blur, you should change the blur radius, see this answer.

can I show blur effect in view, even if its not on top of uitableview?

for example if I have UIViewController , 50% is UIView, and 50% is UITableView.
can I show blur in UIView, of 25% part from uitableview ?
meaning, the UITableView is not behind the UIView, but tell the iOS to show the blur effect -like- is behind it ?
hope I'm clear here.
Are you trying to use a UIToolbar to give blur effect to a whole UIVIew/UITableView?
If that's what you're trying to do then the answer is yes, everything behind the UIToolbar will be blurred in-real-time.

Cut out image of UIView to reveal background tint

I currently have a main UIView that I have subclassed and set a custom background colour from a UIImage.
I also have a .png with a transparent background - lets call it myImage.png.
I want to be able to add the myImage.png to the main view so that I am able to animate the non-transparent portion of my UIImage. I assume that this could be achieved with the use of layers and image masking but I would really appreciate an example to get me started.
EDIT
To clarify, I am interested in knowing how I can use core graphics to cut out the myImage.png and reveal a tint colour. I can then animate this tint colour to give a flashing effect. I am able to animate the image without a problem, so I need a solution to the problem of 'cutting out' the image and revealing a background tint that I my animate in and out.
I am using iOS6
Thanks in advance.
You can play around with CAGradientLayer, CATransformLayer, CAReplicatorLayer.
As I understand your question you have a .png with transparent background and you want to animate the non-transparent part of this .png (myImage.png) you want to add myImage.png to your main view with an animation. Take a look of this apple documentation link of Core Animation
https://developer.apple.com/library/ios/documentation/Cocoa/Conceptual/CoreAnimation_guide/CreatingBasicAnimations/CreatingBasicAnimations.html
It will help you with what you want

IOS - How to draw a border and a shadow that rotates with view but doesn't scale with it

I am developing an ios app.
In my app I have got a view, the view is has got a border and a shadow.
The view can be scaled and rotated.
When a user scaled my view it causes my border and shadow to scale as well.
I don't want my shadow or border to scale at all.
On the other hand I do want my shadow and border to rotate when I rotate the view.
Is there any built in mechanism to prevent border \ shadow scale?
Thank you
As far as I know there isn't such a built in mechanism.
The only way I see for you to solve your problem is to simply use two different views, with different management in case of rotation.
Have one view as a sort of background and add your border and shadow to it, and then place the content on top of it (or in it, depends on your case).

Resources