Questions tagged [animatewithduration]

a block-based animation method for the UIView class in iOS, to automatically "tween" animations.

Automatically transitions from the starting state, to the specified ending state, over the specified duration.

Related links

151 questions
0
votes
1 answer

Animation After Background Thread Complete (iOS / Swift)

I'm looking to animate a few things when a long process (parsing) is complete. My barebones code currently looks like such: func run_on_background_thread(code: () -> Void) { …
Ryan
  • 195
  • 2
  • 14
0
votes
1 answer

Odd error when capturing function parameter in Swift call to animateWithDuration:Animations:

I'm writing some simple animation code to make a button get taller and then shorter using UIView animations. The code is a little long, but fairly simple: func animateButton(aButton: UIButton, step: Int) { let localStep = step - 1 let…
Duncan C
  • 128,072
  • 22
  • 173
  • 272
0
votes
1 answer

Continuous animation in iOS?

In my case I have a view with content. I want to scroll this content on UILongPressGestureRecognizer events: if the touch position y is enough near the up view border then scroll up; if the touch position y is enough near the bottom view border…
0
votes
1 answer

How to convert a CABasicAnimation to UIView animatewithDuration

I want to convert a CABasicAnimation to UIView animatewithDuration , If there is any possible to do that? This is my tried code so far CABasicAnimation *myAni = [CABasicAnimation animationWithKeyPath:@"transform.scale.x"]; myAni.duration =…
Eric
  • 3,811
  • 5
  • 15
  • 18
0
votes
3 answers

using animatewithduration to move image view

I am trying to move an image multiple times. This is how i tried implementing it. override func viewDidAppear(animated: Bool) { UIView.animateWithDuration(1, animations: { () -> Void in self.sattelite.center.x = 50 …
Mbusi Hlatshwayo
  • 554
  • 1
  • 10
  • 23
0
votes
1 answer

swift rotating view pause

I want to make infinite rotation. But I see a rotating pause. Can you explain why? UIView.animateWithDuration(0.5, delay: 0, options: UIViewAnimationOptions.Repeat | UIViewAnimationOptions.CurveLinear, animations: { …
Vasily Bodnarchuk
  • 24,482
  • 9
  • 132
  • 127
0
votes
2 answers

Recursive animateWithDuration: animations: completion: method iOS

I am attempting to make my item "glow" every 3 seconds changing its alpha from a high to low value and back. It however "flickers" and basically changes every 0.2 seconds from color to color randomly. I have pasted the method below. Its probably…
John
  • 1,677
  • 4
  • 15
  • 26
0
votes
1 answer

animating a uicollectionviewcell, text alignment off center during animation

I am animating a UICollectionViewCell to shrink when tapped. The animation works, however it seems the text is moving to the left and the animating towards the center over the duration i've set (0.3 seconds in this case). I have tried a few…
jshbrmn
  • 1,737
  • 3
  • 22
  • 52
0
votes
1 answer

How to implement a CADisplayLink into a for in loop

So I am generating a bunch of dot objects using a for in loop and I am animating them across the screen using UIView.animationWithDuration; however, I want to replace the animationWithDurations with CADisplayLinks so that the user is able t interact…
Garret Kaye
  • 2,412
  • 4
  • 21
  • 45
0
votes
2 answers

UITextField Disapearing

I have a UITextField which animates onto the view controller (moves in from the right hand side onto the view) when I press a button. However, when I press on the UITextField or any other view, the UITextField disappears. How can I stop the…
StevenZ
  • 6,983
  • 5
  • 16
  • 18
0
votes
2 answers

How can I animate UILabels from an array to move across the screen with an equal delay between them?

I have an array of UILabels that I want to animate across the screen. I am iterating though the array using a for loop like below: for(int i=0; i<[self.onScreenLabels count]; i++) { UILabel *label = self.onScreenLabels[i]; int x =…
Kex
  • 8,023
  • 9
  • 56
  • 129
0
votes
1 answer

Shrink and Transform UIButton

I am trying to transform my UIButton left when clicked, and I want it to shrink at the same time as well. I have tried the following code, and it does transform left, but I do not know how to shrink the button. How could I shrink and transform the…
StevenZ
  • 6,983
  • 5
  • 16
  • 18
0
votes
1 answer

Interrupting animateWithDuration

I've got an animated timer bar that counts down, and I want to be able to cancel the animation and reset the bar when certain conditions are met so it doesn't get all the way to 0. Similarly, if it does make it to 0 I want to call a function. For…
Erik
  • 2,299
  • 4
  • 18
  • 23
0
votes
0 answers

Moving a control with segmentControl

I'm working on an app where 1 ViewController has a UISegmentControl with these behaviours: Segment 1 (if it's not already in position): Fade in items Slide segment control down Segment 2 (if it's not already in position): Fade out items Slide…
Erik
  • 2,500
  • 6
  • 28
  • 49
0
votes
0 answers

Using UIPanGestureRecognizer in conjunction with animateWithDuration block ios

I'm coding an ios application and the basic View is a UIMapView. On the UIMapView I have a UIImageView. I want this UIImageView's initial state to animate up and down on repeat on the screen. When a user pans across the map I would like the…