ios,swift,uiview,uigesturerecognizer,animatewithduration
You have to use animateWithDuration(_ duration: NSTimeInterval, delay: NSTimeInterval, options: UIViewAnimationOptions, animations: () -> Void, completion: ((Bool) -> Void)?) for that. And provide AllowUserInteraction as an option to allow the user to interact with the view during animation. See the docs for more options....
ios,swift,delay,increment,animatewithduration
for button in options { UIView.animateWithDuration(1.0, delay: increment, usingSpringWithDamping: 0.7, initialSpringVelocity: 0.0, options: nil, animations: { button.center.y -= self.view.bounds.height }, completion: nil) } increment = increment + 0.05 } Besides: Change this let increment = 0.25 To var increment = 0.25 Increase the increment outside animation. Because animateWithDuration is an...
swift,closures,animatewithduration
Calling methods in the same class are called with an implied self. In this case because of the closure you have to make it explicit: self.animateButton(aButton, step: 1) ...
ios,objective-c,animation,uiviewanimation,animatewithduration
You can't reach running animation property if you're using UIKit Animations. So I suggest to using Core Animation if you want to modify animation in the runtime of it. And it's too simple to removing alpha of the view like below. CABasicAnimation* fadein= [CABasicAnimation animationWithKeyPath:@"opacity"]; [fadein setToValue:[NSNumber numberWithFloat:1.0]]; [fadein setDuration:0.5];...
ios,animation,swift,uibutton,animatewithduration
If you're using an iPhone simulator, try using 50 instead of 500 as the screen width is small and your text field is thus displayed off screen joinTextField.frame.origin.x=**50** joinTextField.frame.origin.y=100 override func viewDidLayoutSubviews(){ joinTextField.center = CGPointMake(joinTextField.frame.origin.x-**50**, joinTextField.frame.origin.y) } ...
ios,objective-c,animation,cabasicanimation,animatewithduration
[UIView animateWithDuration:0.5 delay:1.0 options: UIViewAnimationOptionCurveEaseInOut animations:^{ //self.myView.transform = CGAffineTransformMakeScale(2.0,1.0); self.testview.layer.transform = CATransform3DMakeScale(2.0,1.0,1.0); } completion:^(BOOL finished){ }]; ...
ios,objective-c,uitableview,nslayoutconstraint,animatewithduration
Every time you update a autolayout constraint, you have to call layoutIfNeeded, - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [UIView animateWithDuration: 0.5 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{ tabConstraint.constant = selected ? 40 : 20; [self layoutIfNeeded]; } completion:nil]; } ...
ios,animation,scroll,uiscrollview,animatewithduration
I think this is something you best do yourself. It may take you a few hours to create a proper library to animate data but in the end it can be very rewarding. A few components are needed: A time bound animation should include either a CADispalyLink or a NSTimer....
ios,swift,uiviewanimation,uianimation,animatewithduration
This is because Swift needs to know the kind of objects inside the subviews NSArray before sending methods. NSArray is automatically converted in a swift Array of AnyType objects, thus it doesn't know which kind of objects are extracted from the array. By casting the array to be an array...
ios,objective-c,animation,nested,animatewithduration
The best solution I found out is RZViewActions. Advantages for my case: operate with animations as with objects without nested blocks; serial and parallel animations are "sequences" and "groups" which are objects too created from simple arrays of animations; just take its demo, remove [self.spinner startAnimating];, run and click the...
ios,xcode,swift,uiimageview,animatewithduration
You can use scaling using UIView's transform property. It seems like scaling does not allow you to make the value 0 and it goes to the final value without any animation. So, you could basically make the scaling y value negligible like 0.001. imageView.transform = CGAffineTransformMakeScale(1, 0.001) You could also...
swift,swift2,animatewithduration
It turns out it's a very simple fix, just change options: nil to options: []. Working code: UIView.animateWithDuration(0.5, delay: 0.3, options: [], animations: { self.username.center.x += self.view.bounds.width }, completion: nil) ...
ios,uilabel,uiviewanimation,animatewithduration
The delay is relative to the time at which you create the animation, so, because all of the animations are created at the same time in the loop they all have the same delay. Instead, set the delay to the iteration index (i): [UIView animateWithDuration:0.3 delay:i options:0 animations:^{ ... so...
ios,swift,for-in-loop,cadisplaylink,animatewithduration
You'll only want to add one CADisplayLink. var displayLink: CADisplayLink! override func viewDidLoad() { // ... for loopNumber in 0...100 { // ... } displayLink = CADisplayLink(target: self, selector: Selector("moveDots")) displayLink.frameInterval = frameInterval displayLink.addToRunLoop(NSRunLoop.mainRunLoop(), forMode: NSRunLoopCommonModes) } func moveDots() { for dot in self.subviews { // calculate its new position...
ios,animation,uibutton,animatewithduration
You can add this code inside your animation block. Which scale the button to half of its size. button.transform = CGAffineTransformMakeScale(0.5, 0.5); ...
swift,uiviewanimation,swift2,animatewithduration,xcode7-beta2
The animation happens in a completion block, so basically you are running two animations at the same time, I indicate what is happening in the code in the code below. func animateMessage(label: UILabel, delay: Double){ label.alpha = 0.0 //1 - Start animation 1 UIView.animateWithDuration(1.2, animations: { //3 - Finish animation...
closures,swift,ios8,animatewithduration
This is a good one, tricky! The issue is in your completion block... A. I would begin by rewriting it like this: (not the final answer, but on our way there!) { _ in self.storedCells.removeAtIndex(1) } (the _ in place of the "finished" Bool, to indicate to the reader that...
objective-c,nstimer,animatewithduration
I'd try enabling the UIViewAnimationOptionBeginFromCurrentState option in your animation code and see if that helps
ios,uiview,catransform3d,animatewithduration,uilongpressgesturerecogni
I am not sure if I understood your question correctly, here I share a method that listens to longPressRecognizer and animates a view as long as user presses onto that view. As user stops pressing, view animates back to its default state. You can check if user gesture satisfies your...