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
24
votes
9 answers

How to switch automatically between viewPager pages

I have an android application that employs a ViewPager with two pages When the activity first displays i would like to present each page in turn to the user so that they know they can swipe between to two views. I have failed to find any docs…
Hector
  • 4,016
  • 21
  • 112
  • 211
24
votes
7 answers

How to animate the width and height of a UIView in Xcode?

I have this subview I want to add to my main view, but make it expand from the origin. I read some of the Apple documentation but I don't understand where I am making mistake. I can animate the origin of the frame, i.e. to get it slide in from…
Hudson Buddy
  • 726
  • 2
  • 9
  • 20
23
votes
5 answers

NSLayoutConstraint constant not updating after setting

I have a UIView subclass with a corresponding xib file. In my xib I have a NSLayoutConstraint property which I'm trying to animate. I have an animateIn method. The problem is that only the animateIn method works. When I try to update the constant…
Ramin Afshar
  • 989
  • 2
  • 18
  • 34
23
votes
5 answers

UIView animateWithDuration and UIProgressView setProgress

I want to animate my UIProgressView progression from 0 to 1 during 10 seconds. Code: [UIView animateWithDuration:10.0 animations:^{ [_myProgressView setProgress:1 animated:YES]; } completion:(BOOL finished)^{ if (finished) NSLog(@"animation…
gobtronic
  • 331
  • 1
  • 2
  • 12
23
votes
2 answers

How to synchronously animate a UIView and a CALayer

To illustrate this question, I gisted a very small Xcode project on Github (two classes, 11kb download). Have a look at the gist here or use git clone git@gist.github.com:93982af3b65d2151672e.git. Please consider the following scenario. A custom…
epologee
  • 11,229
  • 11
  • 68
  • 104
22
votes
2 answers

How can I define multiple options for UIViewAnimation?

Probably it is just a question of proper syntax. I use the animateWithDuration:delay:options:animations:completion: UIView method. The options: is the problematic part here: when I assign only one option (for example…
Sergey Lost
  • 2,511
  • 3
  • 19
  • 22
22
votes
1 answer

Why are animations on bounds of an UILabel only working when increasing the size?

I noticed that when i change the bounds of an UILabel in an animation block it only works if i increase the size, when i decrease the size the UILabel just changes his size but doesn't animate. Replacing the UILabel with a plain UIView works as…
peko
  • 11,267
  • 4
  • 33
  • 48
22
votes
5 answers

Creating slow scrolling to indexPath in UICollectionView

I'm working on a project where I'm using a UICollectionView to create an 'image ticker' where I'm advertising a series of logos. The collectionView is one item high and twelve items long, and shows two to three items at a time (depending on size of…
Chris
  • 803
  • 2
  • 9
  • 22
21
votes
6 answers

How to flip an individual UIView (without flipping the parent view)

This is an iPad project where I have a UIView with several subViews, and I am trying to animate one of this UIViews using [UIView transitionFromView:toView:duration:options:completion], but when I run this method the whole parent view gets…
DanMunoz
  • 936
  • 1
  • 8
  • 10
21
votes
6 answers

Swift 3 UIView animation

Since upgrading my project to swift 3 my autolayout constraint animations aren't working; to be more specific, they're snapping to the new position rather than animating. UIView.animate(withDuration: 0.1, delay: 0.1, …
Alex Brown
  • 1,613
  • 1
  • 13
  • 23
21
votes
1 answer

Remove animation in swift

I have a text field where user should enter info. And a label which points user to text field (like a hint). I want to stop animation and remove hint label once user presses the text field to enter data. There is repeating animation on text label.…
Almazini
  • 1,825
  • 4
  • 25
  • 48
21
votes
3 answers

Animate frame and layout change of UICollectionView

I am trying to create an effect where I change the layout of my UICollectionView while changing the frame size Initially the collectionView layout presents a "thumbnail" gallery style full screen. After resizing the frame to a thin strip - I would…
Avba
  • 14,822
  • 20
  • 92
  • 192
21
votes
7 answers

UIView animation block: if duration is 0, is it the same as without animation?

I need to handle a case where you can do something with or without animation, instead of: if (animation) { [UIView animateWithBlock:^(){...}]; } else { ... } I want to do: [UIView animateWithBlock:^(){...} duration:(animation ? duration :…
hzxu
  • 5,753
  • 11
  • 60
  • 95
21
votes
2 answers

UIImagePickerController how to do animated switch from rear to front camera?

I have been using custom overlay for UIImagePickerController controller, and everything is working fine. I have added button to switch between front and rear camera via - - (IBAction)changeCamera:(id)sender { if (self.imagePicker.cameraDevice ==…
MegaManX
  • 8,766
  • 12
  • 51
  • 83
20
votes
4 answers

How to cancel UIViews block-based animation?

i currently focus the following problem: i start an animation, where 2 objects-attributes are triggered. the code is: [UIView animateWithDuration:0.3 animations:^{ greyscaleImage.alpha = 1; activityIndicator.alpha = 1; }…
thedanielhanke
  • 730
  • 1
  • 6
  • 22