FAQ Database Discussion Community


Image sequence animation with multiple animationDuration iOS

ios,objective-c,uiviewanimation
I can load some UIImage from an array in an UIImaheView with animationImages & startAnimating properties, with a fixed animationDuration. Like this: - (void)viewDidLoad { [super viewDidLoad]; self.imageNamesArray = [[NSMutableArray alloc] initWithObjects:@"0001.png", @"0002.png", @"0003.png", @"0004.png", @"0005.png", @"0006.png", @"0007.png", @"0008.png", @"0009.png", @"0010.png", @"0011.png", @"0012.png", @"0013.png", @"0014.png", @"0015.png", @"0016.png", @"0017.png", @"0018.png", @"0019.png",...

Swift UIView Animation block increment error

ios,swift,uiview,uiviewanimation
I have a UIView Animation block that I want to run on paragraphs in an array. UIView.animateWithDuration(0.4, delay: 0.2, options: .CurveEaseOut, animations: { var frame = self.textViewForPlayer.frame frame.origin.y += 20 self.textViewForPlayer.frame = frame }, completion: { finished in UIView.animateWithDuration(0.4, delay: 0, options: .CurveEaseOut, animations: { var frame = self.textViewForPlayer.frame frame.origin.y...

How to implement UIViewControllerContextTransitioning compatible with interactive transitions

ios,uinavigationcontroller,uiviewanimation,uiviewanimationtransition
I am on my way to create a custom navigation controller. Indeed, I would like to have a UINavigationController with a "content view" which is not necessarily the full screen, but which can be any view. Since I also would like to use custom animations for transitions and interactive transitions,...

Changing UIView background color using an animation

ios,objective-c,uiview,uiviewanimation,caanimation
I want to change my UIView background color with a transition animation. For example, if the view is red and I change it to blue. The blue color will slide up from the bottom of the screen to the top and fill the whole screen. I was thinking of doing...

UIButton goes to the starting point of animation when title is changed

ios,swift,uiviewanimation
I'm animating a button to be moved for some distance when pressed. After it travels that distance, it should change its title and stay at that position. However, when the animation is over it jumps back to the starting point and changes it's title. When the same code is run...

Swift - UIView.transitionFromView -

swift,uiview,uiviewanimation,uiviewanimationtransition
What happens to your “fromView” after you use UIView.transitionFromView? How do you get it back? (re-initialize it?). Here’s a simple example I made and get “fatal error: unexpectedly found nil while unwrapping an Optional value” when I try to get back to the “fromView” or reference a label on it,...

UI glitch (black flicker) on right side of navbar during transition

ios,swift,uinavigationbar,uiviewanimation,uinavigationitem
I have an app that has a uipageviewcontroller that is presented on initial launch of the app. On the last page of the uipageviewcontroller I present the main navigation controller with a TransitionCrossDissolve animation. While the animation is ongoing I get a tiny black background flicker on the right side...

How to animate preferredContentSize when using UIPopoverPresentationController?

ios,animation,uiviewanimation
I am able to successfully change the frame of a popover I present by simply setting preferredContentSize. I would now like to animate the change in the content size but I haven't been successful. It just instantly updates, in fact the delay I have set isn't even respected. How could...

Animate view moving up on launch

ios,uiview,uiviewcontroller,autolayout,uiviewanimation
I have a UIImageView which is centred horizontally and vertically in the launch screen. I want to display the same logo on the main storyboard (main view controller) when the launch screen goes, centred horizontally but at the top of the screen. I have added the same image view to...

Slide in an UIButton and push other UIButton when a certain distance is reached

ios,objective-c,uiviewanimation,nslayoutconstraint
I would like to slide in a UIButton (grey color in screenshot) from the left to right and center it on the screen. There is an UIButton (orange color in screenshot) already though that is centered and this button should be pushed to the right and always have a distance...

swift array uiimage animation

swift,uiviewanimation
I'm trying to animate a UIImage and I have an UIImageView called MainPic. This is the code I am using: @IBOutlet weak var MainPic: UIImageView!> MainPic.animationImages = [ UIImage(named: "fox01")!, UIImage(named: "fox02")!, UIImage(named: "fox03")!, UIImage(named: "fox04")!, UIImage(named: "fox06")! ] MainPic.animationDuration = 1 MainPic.startAnimating() I made sure all the images were...

Flip animate UIVIEW only

ios,xcode,uiviewanimation
code: [UIView transitionFromView:vwOne toView:vwTwo duration:1.0 options:UIViewAnimationOptionTransitionFlipFromLeft completion:NULL] I created two views and made IBOutlet connection. I tried a simple flip animation.what i tried is flip animate UIView only.but entire VIEW CONTROLLER is animating....

UIView animateWithDuration jumps to final transform without animation

ios,uiview,uiviewanimation
I have the following code to create flip transition. The fromView does not animate the transform and jumps to the final value but the toView correctly animates transform. What could be wrong here? toView.hidden = NO; toView.transform = CGAffineTransformMake(0, 0, 0, 1, 0, 0); [UIView animateWithDuration:0.4 animations:^{ fromView.transform = CGAffineTransformMake(0,...

Completely unhide view prior to UIView.animateWithDuration

ios,uiview,uiviewanimation
I am using UIView.animateWithDuration to slide in a view upon tap recognition. This is working fine except, for the very first time, the view is unhidden slightly late and it suddenly appears mid-way through the animation. Subsequent show/hide operations do not have this issue. I am implementing this as follows...

Swift cant resolve CurveEaseIn in UIView.animateWithDuration when using parameter from function inside animation block

ios,swift,uiview,uiviewanimation
I am trying to pass parameter to function to change layout constraint in animation block dynamically. This works: func moveKeyboard (up: Bool, newMargin: Int) { UIView.animateWithDuration(0.2, delay: 0, options: .CurveEaseIn, animations: { self.topMarginConstraint.constant=10; }, completion: { finished in println("Animation end!") }) } and this doesn't (i get error "Could not...

Rotate imageView random

ios,swift,uiviewanimation,arc4random
I am trying to get the image view to rotate random degree between 360 and 720. So I want the image view to rotate once(360 degrees), and then again rotate a random degree(0 to 360) func rotateRandom2(){ let lower : UInt32 = 360 let upper : UInt32 = 720 let...

Expanding a circle from centre of the Screen

ios,objective-c,geometry,uiviewanimation,cashapelayer
I am trying to expand a circle from Zero radius to a predefined radius at the centre of the screen. The code is as follows In viewDidLoad:- - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. [super viewDidLoad]; circleRadius = 0.0f;...

Trying to curl up/curl down with two views using AutoLayout in Swift

ios,autolayout,uiviewanimation
Using auto layout I've centered two UIView's on the screen and now I'm trying to transition with a CurlUp from one to the other then CurlDown using this function: func curlUp() { let transitionOptions = UIViewAnimationOptions.TransitionCurlUp UIView.transitionFromView(cardFront, toView: cardBack, duration: 5.0, options: transitionOptions, completion: { _ in let transitionOptions =...

Creating infinite background scroll right to left

swift,uiview,uiviewanimation
I am trying to create an animation to create an illusion of moving object. So the object will stay at the same position but the background image view which is wider than screen width will move infinitely. The code I have doesn't work very smooth. let backgroundView = UIView() backgroundView.backgroundColor...

How i can do an uiimageView zoom animation linked to uiscrollview contentoffest?

ios,iphone,uiview,uiviewanimation
I'm trying to achive an animation that zoom an imageview accordingly to a scrollview offset (i have seen something similar in spotify and some others apps). How i can do? I have tried something like: - (void)scrollViewDidScroll:(UIScrollView *)scrollView { if (Scroll.contentOffset.y<-10 && Scroll.contentOffset.y>-20) { [UIView animateWithDuration:0.1 delay:0 options:UIViewAnimationOptionBeginFromCurrentState animations:(void (^)(void))...

UIView Animation not shown after segue

swift,uiview,uicollectionview,uilabel,uiviewanimation
I have 2 View Controllers. The first one is a Collection View Controller, the second a plain View Controller. When clicking a cell in the Collection View Controller, the second View Controller appears. When the view starts to load in the 2nd view controller, I want to show a UILabel...

app crash while deleting row from within uitableview cellForRowAtIndexPath delegate

ios,uitableview,uiviewanimation
i have a table view.i am implementing a functionality where cells will be start fading(decrease alpha over time duration of 30 secs).After completing 30 secs, completion handler of view animation is called to delete row permanently from data source(an array).All the stuff goes in cellForRowAtIndexPath delegate method. My problem is...

How to Preserve state of UIView Controller when it come back from Background

ios,objective-c,uiview,uiviewcontroller,uiviewanimation
I have created one login Page which have two uiTextField and Login Button. When you try to login Keyboard hide textfield and button, So I have used below code to move up and down view controller from textfield delegate methods. -(void)animateTextField:(UITextField*)textField up:(BOOL)up { int movementDistance = -130; // tweak as...