FAQ Database Discussion Community


Enable user interaction for gesture recognizer during UIView.animateWithDuration()

ios,swift,uiview,uigesturerecognizer,animatewithduration
I have a view (A) that holds several rectangular subviews (B). Each of these subviews have a single tap recognizer to trigger an action. The parent view A also has a single tap recognizer that calls a function on A's controller to make each of the subviews B flash in...

How to implement a CADisplayLink into a for in loop

ios,swift,for-in-loop,cadisplaylink,animatewithduration
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 with the dots (make them tappable). Can someone please...

Nested animation in iOS: combine animated and non-animated code in animateWithDuration?

ios,objective-c,animation,nested,animatewithduration
Nested animation In short the nested animation allows to run 2 independent animations simultaneously. But what to do if I have a complex code which consists of both animated and non-animated code? I mean the following situation: [UIView animateWithDuration:... animations:^{ ...//code1 - with animation ...//code2 - also contains code which...

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

swift,closures,animatewithduration
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 localButton = aButton let halfHeight = aButton.bounds.height / 2 var...

Need help incrementing a parameter in UIView.animateWithDuration in swift

ios,swift,delay,increment,animatewithduration
thanks in advance for any help. I have an IBOutlet Collection of buttons that I am trying to present on screen sequentially. They all start off screen fine, but as they animate in, I'd like each button to be presented on screen 0.05 seconds after the previous button. I can't...

animateWithDuration in UITableViewCell's setSelected method has no effect

ios,objective-c,uitableview,nslayoutconstraint,animatewithduration
I'm trying a simple animation for selection/deselection of a UITableViewCell like this: - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [UIView animateWithDuration: 0.5 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ tabConstraint.constant = selected ? 40 : 20; } completion:nil]; } The code inside the animations block will be called, but it's not animating. Everything works fine, but there's...

How to both scroll and stop UIScrollView programmatically?

ios,animation,scroll,uiscrollview,animatewithduration
There are a lot of similar questions but they all differ from this one. I have UIScrollView which I could both scroll and stop programmatically. I scroll via the following code: [UIView animateWithDuration:3 delay:0 options:UIViewAnimationOptionCurveEaseInOut animations:^{ [self.scrollView scrollRectToVisible:newPageRect animated:NO]; }]; And I don't know how to stop it at all....

Continuous animation in iOS?

ios,uiview,catransform3d,animatewithduration,uilongpressgesturerecogni
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 then scroll down. I can't...

How to convert a CABasicAnimation to UIView animatewithDuration

ios,objective-c,animation,cabasicanimation,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 = 2.0f; myAni.fromValue = [NSNumber numberWithFloat:1.0]; myAni.toValue = [NSNumber numberWithFloat:2.0]; [self.myView addAnimation:scaleAnimation forKey:@"myKey"]; to be in [UIView animateWithDuration.... (Instead...