uiviewanimation

Objective-C: How to animate “Loading…” text on a UILabel

依然范特西╮ 提交于 2019-12-06 16:25:36
问题 In my app I need to display a "Loading" text in an UILabel, repeatedly as follows: Loading Loading. Loading.. Loading... Loading Loading. Loading.. Loading... How can I do it? Any suggestion, please? 回答1: You could easily implement such a behavior yourself – see my example below. But like trojanfoe suggested, I would rather use a nice library like MBProgressHUD or MarqueeLabel - (void) updateLoadingLabel; { if(self.loading) { if([self.labelLoading.text isEqualToString:@"Loading…"]) { self

iPhone: How to commit two animations after another

余生长醉 提交于 2019-12-06 15:45:38
This is an absolute beginner's question (sorry), but I was wondering how to commit one animations and once it has ended to start another one. Imagine having an image moved from x=0 to x=300. Then you want to do animate the same image again, but this time from x=300 to x=330 so that it disappears from the screen. The following code will only do the animation from x=300 to x=330 and will not commit the animation x=0 to x=300. I'm sure I don't get the concept of commitAnnimation and that this is obvious, but how would I do two animations after one another? I know I could move the image

How to make image spin (animation)

a 夏天 提交于 2019-12-06 10:26:36
I have an image which is a square and I know how to make it spin. But not sure how to make it spin exactly like this animation here: Notice how it spins... then stops a little... then spins again... and so on. What I have just is a basic spin but doesn't look like the gif above: extension UIView { func rotate360Degrees(duration: CFTimeInterval = 3) { let rotateAnimation = CABasicAnimation(keyPath: "transform.rotation") rotateAnimation.fromValue = 0.0 rotateAnimation.toValue = CGFloat(M_PI * 2) rotateAnimation.isRemovedOnCompletion = false rotateAnimation.duration = duration rotateAnimation

Slide out navigation through swipes for UIView to overlay another UIView

一曲冷凌霜 提交于 2019-12-06 09:12:20
On my research regarding this navigation technique, I've found this post by Nick Harris which is a good start I suppose. However, what I want is slightly different from this. You can think of it as iOS' Notification Center when you just have to swipe from the top to show the view and just swipe back to hide it again. In my case, I wish to reveal a hidden UIView coming from the right side of the screen with a swipe gesture to the left and also hide it again through the same gesture (this time to the right). I've managed to get a solution on my previous post regarding showing/hiding a UIView.

Repeating UIAnimation block, and a way to stop it again

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-06 07:56:53
问题 I wanted to do a small loader animation to put in my app. I have done repeating animations before with CGAnimations without problems, this time I was going for the block approach. I am doing a small test but can make the following code repeat: - (void) startLoading { __block int count = 0; [UIView animateWithDuration:0.4 delay: 0.0 options: UIViewAnimationOptionRepeat animations:^{ count++; } completion:^(BOOL finished){ if (count > 5) count = 0; NSLog(@"%d", count); }]; } - (void)

Multiple Simultaneous UIViewAnimations on a Single UIView

前提是你 提交于 2019-12-06 05:44:16
问题 Goal : Have several animations play at the same time on a single UIView. Problem : From what I can tell, this is not possible. Each animation has to occur in sequence and cannot overlap. In essence, I want a single UIView to animate vertically while animating horizontally at the same time. Since I'm using UIViewAnimationOptionRepeat , I cannot nest any other animation in onCompletion: Here's what I want to work but doesn't: [UIView animateWithDuration:duration delay:kANIMATION_DELAY options

Slider view for iOS

我们两清 提交于 2019-12-06 03:26:40
Can someone help me with this scenario? *There is a button, which when tapped, slides opens up a UIView, with the tapped button still to its left. *This button when tapped again, makes the UIView slide back. What you describe is easy. Let's call the view that slides in from the right a drawer ("drawerView"). Set up the drawer view as a child view of your view controller's main view. Make that "drawer" view a container view. Put everything you want inside it. (Your text view, buttons, etc.) Also put your button inside this view. Connect that button to an action "slideDrawer" in your view

non UIView animation: animations not playing sometimes, UIView animation: working fine

社会主义新天地 提交于 2019-12-06 03:07:22
Sometimes when I run my app on the device, I guess about 20% of the time, animations such as: [tableView setEditing:NO animated:YES]; [tableView setContentOffset:rect animated:YES]; and [viewController0 pushViewController:viewController1 animated:YES]; do not animate but instantly change. But animations such as: [UIView animateWithDuration:0.2 animations:^{ // do something } completion:^(BOOL finished) { // do something else }]; Work fine. Has this happened to anybody else? Not sure what could be causing it, it only happens on this one app, never happened on any other app and it only happens

UIView Animation in Swift not working, wrong arguments error

夙愿已清 提交于 2019-12-06 01:08:41
问题 I'm trying to do an animation and used the below code. I'm getting "Cannot invoke 'animateWithDuration' with an argument list of type '(FloatLiteralConvertible, delay: FloatLiteralConvertible, options: UIViewAnimationOptions, animations: () -> () -> $T4, completion: (Bool) -> (Bool) -> $T5)'" Error . This means I'm using wrong arguments. I could be wrong. Please help in this. I couldn't really resolve it. var basketTopFrame = CGRect() basketTopFrame = dropPlace.frame var mytimer : NSTimer =

Animate a UIImageView from center of the UIImageView

巧了我就是萌 提交于 2019-12-05 23:37:41
I have a UIImageView that should animate from size (0,0) --> (93,75) I have the following [UIView animateWithDuration:0.5 delay:0 options:UIViewAnimationOptionTransitionNone animations:^{ imgButton.layer.anchorPoint = CGPointMake(imgButton.bounds.size.width/2, imgButton.bounds.size.height/2); CGRect btnFrame = imgButton.frame; btnFrame.size.width = 105; btnFrame.size.height = 85; imgButton.frame = btnFrame; } completion:^(BOOL finished) { [self animageButton2:imgButton]; }]; This is working but the only problem I have is that it is not animating from the center of the UIImageView but from the