UIPageViewController and interactive animation - ios

How can I achieve an animation that progresses with the finger movement;
e.g. transition of background color from white to black in a smooth manner (as the finger moves from 1 VC to the next).
Can it be made using UIPageViewController?
Thanks!

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 ?

How to reproduce the night mode animation in Tweetbot 4

It is not difficult to change the background color of the table view and every single cell. The difficult part is to animate this change with a sliding effect. As the dark color slides from the top of the screen to the bottom, you also have to coordinate the color change of the navigation bar and tab bar. Any ideas possible solutions?

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

Setting Animation behaviour for UIImageView

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:

iPad: touchesBegan not being called when dragging finger from upper screen border

I am writing an ipad application where you can drag around the screen with 1 or 2 fingers. I use the touchesBegan, touchesMoved and touchesEnded methods to recognize the touches. I have multipletouches enabled for the view.
Now I have recognized one strange behaviour. If I place a finger outside of the upper screen border and drag it down to the screen I won't receive a call to touchesBegan or touchesMoved. This can not be reproduced for the other screen borders.
The only other case where it can be reproduced is when I use landscape orientation with the home button to the left side. In this case I get the same behaviour for the upper screen border.
Has anyone information about this or does experience the same if testing?
Edit:
I did some additional testing. The area where the statusbar would normally be is receiving touchesBegan or touchesMoved very fine if i put down the finger in that region or slide it upwards from any lower screen position. The input is not recognized only if i slide the finger down from a position that is completly above the screen edge.
Edit2:
Additional Info:
- My app uses an OpenGL view.
- The statusbar is hidden.
- touchesBegan is called properly when touching the (hidden) statusbar areas in all orientations.
I believe the underlying issue is that the touch-sensitive layer on the screen extends a few pixels above the visible screen, meaning that touches originating there technically start outside your UIViewController view. Since your UIViewController only sees touches that originate within its view, it won't see these touches. So if your device screen is touched a pixel or two above the visible pixels, the touch will be sent to whatever virtual layer exists in that offscreen area (perhaps the status bar?). This prevents your UIViewController from receiving any touches, since the swipe did not originate in your UIViewController's view area.
To work around this, at applicationDidLaunch time you can resize your UIWindow to be (say) 10 pixels larger on each side, and create an intermediate UIViewController 'background' layer inside it, matching the expanded size of the window. Then set your main interface UIViewController view to be a child of the 'background' view, inset 10 pixels on all sides to re-match the physical screen size. If your interface rotates, the 10-pixel enlargement of the background view will have to be re-applied in the willAnimateRotationToInterfaceOrientation method in your background UIViewController each time.
Finally, have the touchesBegan/Moved/Ended methods in the background view controller forward their touches directly to the corresponding methods in your main UI view controller. Voila!
Hope this helps,
Ben
Sounds right to me. If you drag your finger across the status bar first, it will receive all touch events for this finger until you lift it. All touch events are delivered to the view in which the touch began.
unfortunately touchesBegan cannot be called from the status bar area.

Resources