Setting Animation behaviour for UIImageView - ios

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:

Related

UIViewController transparent background colour

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 ?

why does my UIView background distort when segued to next view?

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.

gradient background iOS

This rectangular region has a gradient background which is also transparent. Texts can be written on the rectangle. The colour of the rectangle changes when the user touches it. When the user releases it, it takes you to a new screen. How should something like this be implemented in iOS?
Use
UIImageView with gradient backgroundImage
set its alpha to 0.6 -.75 so that background view is visible
Use Tap gesture recognizer on ImageView to change background Image when user tap and navigate to next view

mysterious white antialiasing behind UIImageView

I'm using a PageViewController to swipe through a series of daily ViewControllers for a week.
The UIViewController that contains the pageViewController contains a few navigation items that do not scroll with the pageViewController. These stay stationary as you swipe. One of these items is a UIImageView, more specifically a UIButton with an UIImageView image representation.
The trouble I'm having is that this stationary UIImageView has a thin white border to it when it should not. I'm giving it a rounded appearance by using rounded corners that are the size of the image. It is easiest seen in this photo. Note, the white "halo" is not part of the image, it appears for any image. The borderColor, imageBackground, view background, and parent view backgrounds are all clearColor. The red background below is part of the swipeable viewController. Interestingly, the white border only appears when it is stationary. If the image/button is placed in the swipeable View it looks great.
Any thoughts how I can get rid of this white antialiasing?
I changed the button's image from using the backgroundImage to just the image property and the white went away entirely. Glad for an easy fix, hope this helps someone else.

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