I have a background image and a visual blur effect layer on top of that image placed behind all the Views in my storyboard. Whenever I segue to the next view, my background does this sort of gyrating/quivering gesture distorting it for a second, then returns to its regular state. This only happens when I segue to a new view, not when I go back to previous views. Does anybody know why this is occurring?
UIVisualEffectView does not like being animated or it's opacity being changed. I believe it has to do with its optimizations for blur efficiency. Try setting the layer's shouldRasterize property.
Related
I'm trying to achieve the following behavioural attached in the image and I did it using vies with custom classes, the question is that how can I achieve this using view controllers,
the behavioural works as follow: when tapped and swipe left the previous screen should start appear but without pop from navStack, just slide to show and when user leave his finger will return to initial state which same as above image, I did it by adding a UIGestureRecognizer on this white slide edge start change the x position for the upper view but, both upper and previous are views not UIViewColtrollers, the question is how to implement this using UIView controllers or make the background colour of the upper view controller transition colour.
have any idea about this or do sth like this before to help ?
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.
I have a UIScrollView that shows certain images based on an index. When an image loads, I want to set the background of the UIScrollView to the blurred version of that image.
Right now I have a container view that houses the scrollView, and I've been trying to add a blurred subView to the container but it's not working out. If I just add the subview it gets rendered over the scrollView which id obviously no good, and If I add the subView and send it to back then I don't see any blurred effect at all.
Is this the right approach or is there a better way to achieve the effect I'm going for?
As you said "and If I add the subview and send it to back then I don't see any blurred effect at all."
To sort it out, You may try changing the background color of Scrollview to clearColor.
I have an image view which is a circle with the upper half in black and the lower half as white with another black circle at the center.
If I swipe up then the white color should increase from both the ends simultaneously... I have added a UISwipeGestureRecognizer and gestures are detected
How to increase the color from the lower half using animation?
Is there a way where I can set alpha value while swiping up, using animation?
Several things:
A swipe gesture is a one-shot. It fires once, and doesn't give you a chance to animate as the user drags. You want a pan gesture recognizer for that.
There is no off-the-shelf animation that will animate color changes to different parts of the image as you describe. You'll have to create your own. Your description is kind of vague, so it's a bit hard to give you suggestions. Do you want to replace the previous contents of your image view with pure white, coming from the top and bottom, or do you want to brighten your original image view towards white? You need to describe the effect you're after in a lot more detail. You could probably get the effect you are after using Core Animation and either a CAGradientLayer or a CAShapeLayer. A gradient layer could act as either an overlay that would cover the image view underneath, or as a mask that would reveal a new image on top in the final state you're after.
As to your question #2, animating the alpha is trivial. Again, you need to use a pan gesture recognizer, not a swipe gesture recognizer. Then you could adjust the alpha value of the view as the pan position moves up the view. You could also trigger a crossfade style animation with a swipe gesture, and use UIView animation methods like animateWithDuration:animations:
Messing around with pushViewcontroller due to one of the awkward requirement :/
So there is a rootViewcontroller with 1 Background Image and UITableView with custom cells and there is a detailViewController with similar backgruound image with different views.
Requirement is:
On tap of UITableViewCell... the whole navigation animation should not affect the background image. Background Image should stay as it is and all other view should slide.
How I can slide only UITableView and display detail screen without changing background image ?
There is one possible solution is just add 2 child view controller and apply slide animation on both child. But in that case I have to keep on removing the child. I can't remove child because on tap of custom bottom back button I have to display the 1st screen instantly.
Any other possible solution or improvement ?
You can wrap your UINavigationController in a custom view controller that contains the background image. Then make sure your content view, as well as the pushed controller's views have a clear background.