Questions tagged [uiviewanimation]

There is no default class called UIViewAnimation, this tag refers to methods that perform animation on UIView objects.

includes a number of different ways to perform animations. One of the simplest is to use the animation support in the UIView class.

Prior to iOS 4, the only way to do UIView animation was with beginAnimations:context/commitAnimations. Those methods are discouraged in iOS 4 and later.

For iOS versions greater than 4.0, you should use the new UIView class methods whose names start with animateWithDuration:

1798 questions
47
votes
5 answers

How to animate a UIView with constraints in Swift?

In my contrived example, I have the following single view: As you can see, it consists of a few simple constraints: Align horizontal and vertical centers, Height (set to a constant) Leading and trailing spaces (set to constant) What I'm seeking…
naivedeveloper
  • 2,814
  • 8
  • 34
  • 43
45
votes
12 answers

iOS Segue - Left to Right -

I've read the other posts on segues but none solve my question. Simply put, my ViewControllers are ordered, like a book. I want backward transitions (example: from page 9 to 8) to always present (slide over) from left to right. I want forward…
Dave G
  • 12,042
  • 7
  • 57
  • 83
44
votes
2 answers

UIView.animateWithDuration swift loop animation

In ViewController.Swift I managed to make a box animate from one point to another. I thought it would be easy to loop this so the box will animate to one point and then animate back to its original position and then loop again. I have managed to…
JLR
  • 723
  • 1
  • 8
  • 17
43
votes
3 answers

UIView animation based on UIPanGestureRecognizer velocity

I would like to be able to move a subview on and off the screen much like you browse between images in the iPhone's build in Photos app, so if the subview is more than 1/2 off screen when I let go with my finger it must animate off screen, but it…
43
votes
3 answers

UIView animation options using Swift

How do I set the UIViewAnimationOptions to .Repeat in an UIView animation block: UIView.animateWithDuration(0.2, delay:0.2 , options: UIViewAnimationOptions, animations: (() -> Void), completion: (Bool) -> Void)?)
Morten Gustafsson
  • 1,869
  • 2
  • 24
  • 34
41
votes
3 answers

How to make UIView animation sequence repeat and autoreverse

How to make this complex animation repeat and autoreverse? Is there any way to add options UIViewAnimationOptionAutoreverse | UIViewAnimationOptionRepeat to this animation sequence? [UIView animateWithDuration:1.0f animations:^{ …
B.S.
  • 21,660
  • 14
  • 87
  • 109
40
votes
4 answers

UIView animations with autoreverse

I have a problem with the setting UIViewAnimationOptionAutoReverse. Here is my code. CALayer *aniLayer = act.viewToChange.layer; [UIView animateWithDuration:2.0 delay:1.0 options:(UIViewAnimationCurveLinear | UIViewAnimationOptionAutoreverse)…
Stultus
  • 814
  • 2
  • 11
  • 15
37
votes
1 answer

UIView.animate - Swift 3 - completion

How do I do a simple completion block in Swift 3? I want to set self.isOpen = true in the completion of the animation: UIView.animate(withDuration: 0.25, delay: 0.0, options: [], animations: { self.isOpen = true …
Chris Allinson
  • 1,837
  • 2
  • 26
  • 39
33
votes
1 answer

Failed to receive system gesture state notification before next touch

I have a control that will switch two views alternatively in a view. ie, Two view controllers are added by sub view method in a container view. A pinch out gusture zooms in current view, and shows the second view. If wish to go to the previous view,…
33
votes
4 answers

iOS - completion block in UIView animateWithDuration gets called too early

I'm trying to do some animation when a table view cell gets selected. For some reason, the completion block is getting called way too early. Even setting the duration to 10 seconds, the completion block gets called immediately. [UIView…
ryan
  • 1,324
  • 2
  • 18
  • 29
33
votes
9 answers

UIView animation jumps at beginning

I'm running this code... [UIView animateWithDuration:0.2 delay:0.0 options:UIViewAnimationOptionCurveEaseOut animations:^{ CGAffineTransform settingsTransform =…
Fogmeister
  • 76,236
  • 42
  • 207
  • 306
32
votes
11 answers

UIView.animateWithDuration Not Animating Swift (again)

Note: I’ve already checked the following stack overflow issues: 27907570, 32229252, 26118141, 31604300 All I am trying to do is fade animate in a view (by alpha) when called by an IBAction attached to a button. Then reverse when a button on the view…
Dru Freeman
  • 1,766
  • 3
  • 19
  • 41
30
votes
7 answers

Swift: move UIView on slide gesture

I am trying to move a UIView on slide up gesture from its initial position to a fixed final position. The image should move with the hand gesture, and not animate independently. I haven't tried anything as I have no clue where to start, which…
Nagendra Rao
  • 7,016
  • 5
  • 54
  • 92
28
votes
5 answers

Stop an auto-reverse / infinite-repeat UIView animation with a BOOL / completion block

I'm setting up the following UIView animateWithDuration: method, with the intention of setting my animationOn BOOL elsewhere in the program to cancel that infinite looped repeat. I was under the impression that the completion block would be called…
Luke
  • 9,512
  • 15
  • 82
  • 146
24
votes
3 answers

How to properly animate UIScrollView contentOffset

I have UIScrollView subclass. Its content is reusable - about 4 or 5 views are used to display hundreds of elements (while scrolling hidden objects reused and jumps to another position when its needed to see them) What i need: ability to…
Lloyd18
  • 1,679
  • 1
  • 18
  • 28