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
37
votes
4 answers

Whats the Swift animate WithDuration syntax?

I'm porting an older app over to Xcode 7 beta and I'm getting an error on my animations: Cannot invoke 'animateWithDuration' with an argument list of type '(Double, delay: Double, options: nil, animations: () -> _, completion: nil)' Here's the…
Dan Beaulieu
  • 19,406
  • 19
  • 101
  • 135
13
votes
1 answer

Animating UIVisualEffectView Blur Radius?

As the title says it, is there a way to animate a UIVisualEffectView's blur radius? I have a dynamic background behind the view so the ImageEffects addition can't be used... The only thing that can do this as far as I know is to animate the opacity…
8
votes
1 answer

animateWithDuration:animations:completion: in Swift

In objective-C my animation bit would look something like this: [UIView animateWithDuration:0.5 animations:^{ [[[_storedCells lastObject] topLayerView] setFrame:CGRectMake(0, 0, swipeableCell.bounds.size.width,…
Nilzone-
  • 2,766
  • 6
  • 35
  • 71
7
votes
1 answer

iOS stop animateWithDuration before completion

I have a CollectionView and I want to create an animation inside the CollectionViewCell selected by the user. I chose to use animateKeyframesWithDuration because I want to create a custom animation step by step. My code looks like this: func…
razvan
  • 133
  • 4
7
votes
4 answers

UIView animateWithDuration is too fast

I have used UIView animateWithDuration to increase the shapeLayer.frame.size.height in the code below, but regardless of the duration it animates very fast. A few posts that I found recommended using some delay time which I've done, but it still…
Jickery
  • 237
  • 4
  • 15
7
votes
2 answers

Consecutive Animation Calls Not Working

I have a button that calls an animateWithDuration code that fades an image out, fades text & a new bg color in , and then resets back to normal. The animation takes a few seconds to complete and works great. However! There's a problem: Sometimes…
Dave G
  • 12,042
  • 7
  • 57
  • 83
7
votes
1 answer

How to execute a lock that waits until an animation completes?

I am implementing a health bar that animates via user input. These animations make it go up or down by a certain amount (say 50 units) and are the result of a button press. There are two buttons. Increase and Decrease. I want to execute a lock on…
Black Orchid
  • 111
  • 1
  • 9
6
votes
2 answers

Prevent click through view in swift

I'm working in Xcode and swift, I created a view acting as a menu that toggles on tap, when the menu comes out I can still click a test button underneath it. I don't want that to happen. I want everything behind the view to be disabled giving…
Yousif Al-Raheem
  • 452
  • 5
  • 15
6
votes
1 answer

Animate UICollectionView sizeForItemAtIndexPath (Swift)

I would like to animate the resizing of a UICollectionViewCell. I have written the code below but cannot have the return line inside the animation block. Any ideas? func collectionView(collectionView: UICollectionView, layout collectionViewLayout:…
6
votes
2 answers

how to add bounce animation to animateWithDuration?

I have a simple animation that im performing in my scroll view delegate method scrollViewDidEndDragging. It looks like this: - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:(BOOL)decelerate { NSLog(@"finger was…
6
votes
4 answers

Content Offset animation broken

I have an animation which is kicked off when a gesture recogniser (double tap) fires: [UIView animateWithDuration:0.3 animations:^{ _scrollView.contentOffset = CGPointMake(x, y); _scrollViewContentView.frame = someFrame; …
Pierre
  • 10,593
  • 5
  • 50
  • 80
5
votes
1 answer

Animate hidden property on UILabels in UIStackView causes different animations

UIStackView makes it really easy to create a nice animation using the hidden property of a UIView. I have two UIStackViews each with UILabels in the arrangedSubviews and when I add a new UILabel to a UIStackView, it should present it with an…
Casse
  • 51
  • 1
  • 6
5
votes
1 answer

Why layoutIfNeeded() allows to perform animation when updating constraints?

I have two states of UIView: I have animation between them using @IBaction for button: @IBAction func tapped(sender: UIButton) { flag = !flag UIView.animateWithDuration(1.0) { if self.flag { …
Bartłomiej Semańczyk
  • 59,234
  • 49
  • 233
  • 358
5
votes
4 answers

animateWithDuration lacks completion block, WatchOS 2

watchOS 2 does not have any kind of completion block in its animateWithDuration function. I'm working on a game that requires running code after an animation is completed. Are there any work arounds? Perhaps using key-value observation? The…
4
votes
1 answer

.Repeat .AutoReverse not working

I am using animations to transform a button when it is clicked, I was able to make the button bigger. However, I thought that by using .Repeat and .Autoreverse, the button would go back to its normal state. (scale 1.0) but that is not the case! …
Jesus Rodriguez
  • 2,571
  • 2
  • 22
  • 38
1
2 3
10 11