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
257
votes
18 answers

Cancel a UIView animation?

Is it possible to cancel a UIView animation while it is in progress? Or would I have to drop to the CA level? i.e. I've done something like this (maybe setting an end animation action too): [UIView beginAnimations:nil context:NULL]; [UIView…
philsquared
  • 22,403
  • 12
  • 69
  • 98
185
votes
22 answers

UIView Hide/Show with animation

My simple goal is to fade animate hiding and showing functions. Button.hidden = YES; Simple enough. However, is it possible to have it fade out rather than just disappearing? It looks rather unprofessional that way.
Jtaylorapps
  • 5,680
  • 8
  • 40
  • 56
137
votes
21 answers

Completion block for popViewController

When dismissing a modal view controller using dismissViewController, there is the option to provide a completion block. Is there a similar equivalent for popViewController? The completion argument is quite handy. For instance, I can use it to hold…
Ben Packard
  • 26,102
  • 25
  • 102
  • 183
114
votes
6 answers

Animate drawing of a circle

I'm looking for a way to animate the drawing of a circle. I have been able to create the circle, but it draws it all together. Here is my CircleView class: import UIKit class CircleView: UIView { override init(frame: CGRect) { …
Roi Mulia
  • 5,626
  • 11
  • 54
  • 105
96
votes
8 answers

Swap rootViewController with animation?

Im trying to swap to another root view controller with a tab bar; via app delegate, and I want to add transition animation. By default it would only show the view without any animation. let tabBar = self.instantiateViewController(storyBoard: "Main",…
Chris Mikkelsen
  • 3,987
  • 9
  • 29
  • 41
95
votes
9 answers

How to load GIF image in Swift?

I have a String with an URL of GIF banner which I need to put into app. My code: func showAdd(){ Request.get("http://www.kyst.no/api/?apiMode=advertisement&lang=no", { (error: NSError?, data: NSData, text: NSString?) -> () in let…
Marius
  • 964
  • 1
  • 7
  • 9
84
votes
16 answers

How can I pop a view from a UINavigationController and replace it with another in one operation?

I have an application where I need to remove one view from the stack of a UINavigationController and replace it with another. The situation is that the first view creates an editable item and then replaces itself with an editor for the item. When I…
82
votes
14 answers

Changing back button in iOS 7 disables swipe to navigate back

I have an iOS 7 app where I am setting a custom back button like this: UIImage *backButtonImage = [UIImage imageNamed:@"back-button"]; UIButton *backButton = [UIButton buttonWithType:UIButtonTypeCustom]; [backButton…
lehn0058
  • 19,977
  • 15
  • 69
  • 109
76
votes
5 answers

UIView animation vs CALayers

I'm struggling with conceptualizing animations with a CALayer as opposed to UIView's own animation methods. Throw "Core Animation" into this and, well, maybe someone can articulate these concepts from a high level so I can better visualize what's…
Meltemi
  • 37,979
  • 50
  • 195
  • 293
73
votes
15 answers

How to rotate image in Swift?

I am unable to rotate the image by 90 degrees in swift. I have written below code but there is an error and doesn't compile func imageRotatedByDegrees(oldImage: UIImage, deg degrees: CGFloat) -> UIImage { //Calculate the size of the rotated…
TechChain
  • 8,404
  • 29
  • 103
  • 228
68
votes
8 answers

UIView animateWithDuration doesn't animate cornerRadius variation

I'm trying to animate the change of the cornerRadius of a UIView instance layer, but the variation of the cornerRadius takes place immediately. Here's the code: UIView *view = [[UIView alloc] initWithFrame:CGRectMake(10, 10, 100,…
Francesco Puglisi
  • 2,140
  • 2
  • 18
  • 26
58
votes
10 answers

Test whether a UIView is in the middle of animation

Is there any way to tell if a UIView is in the middle of an animation? When I print out the view object while it is moving I notice that there is an "animations" entry: search bar should end editing:
prostock
  • 9,327
  • 19
  • 70
  • 118
53
votes
7 answers

Is it necessary to use [unowned self] in closures of UIView.animateWithDuration(...)?

UIView.animateWithDuration(1, animations: { [unowned self] in self.box.center = self.boxTopRightPosition }, completion: { [unowned self] completed in self.box.hidden = true }) Is it necessary…
WildCat
  • 1,961
  • 6
  • 24
  • 35
51
votes
5 answers

iOS: How to convert UIViewAnimationCurve to UIViewAnimationOptions?

The UIKeyboardAnimationCurveUserInfoKey has a UIViewAnimationCurve value. How do I convert it to the corresponding UIViewAnimationOptions value for use with the options argument of +[UIView…
ma11hew28
  • 121,420
  • 116
  • 450
  • 651
47
votes
10 answers

UIButton can't be touched while animated with UIView animateWithDuration

I have the following code: [UIView animateWithDuration:0.3 delay:0.0 options:UIViewAnimationCurveEaseOut | UIViewAnimationOptionAllowUserInteraction animations:^{ CGRect…
Shai Mishali
  • 9,224
  • 4
  • 56
  • 83
1
2 3
99 100