uiviewanimation

How to avoid retain cycle with delaying block invocation on iOS

做~自己de王妃 提交于 2019-12-08 04:02:07
问题 I am really stumped with this one. I have been reading all the info I can get my hands on about how to properly handle variables inside blocks. Note: I am not using arc. So, say I have an animation that looks like this: [UIView animateWithDuration:.5 animations:^{ textCard.alpha = 1.f; self.dotView.alpha = 1.f; self.subtitles.alpha = 0; }completion:^(BOOL finished){ [self.playerLayer removeFromSuperlayer]; self.playerLayer = [AVPlayerLayer playerLayerWithPlayer:self.vidPlayer]; self

PresentViewController with custom “scale-from-center” ModalTransitionStyle

£可爱£侵袭症+ 提交于 2019-12-08 02:41:50
问题 I'm trying to implement custom view presenting transition style. Here is my code: [myViewController setModalTransitionStyle:UIModalTransitionStyleCrossDissolve]; [self presentViewController:myViewController animated:YES completion:^(void){}]; I'd like to achieve “scale from center” effect while presenting views. I made a demo of desired effect with JQuery UI: http://jsfiddle.net/c7ztP/ Is there any way to do this? 回答1: What I would do is the following From the initiating view controller i

What is the best way to wait for a loop of UIView animations to finish?

拜拜、爱过 提交于 2019-12-08 01:06:29
问题 I'm trying to loop over multiple UIViews and perform animation on each, but I'd like to know when all of the animations have finished. What is the best way to call a function when the loop of animations has finished? Alternately, is there a way to wait until all have finished? I tried using setAnimationDidStopSelector , but it doesn't fire. In this case, I'm clearing some "chips" off a game board by having them fade out then get removed (NumberedChipView is a subclass of UIView). Play cannot

Slide out navigation through swipes for UIView to overlay another UIView

做~自己de王妃 提交于 2019-12-08 00:23:38
问题 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

How to make image spin (animation)

故事扮演 提交于 2019-12-07 20:58:53
问题 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

Slider view for iOS

别说谁变了你拦得住时间么 提交于 2019-12-07 16:56:12
问题 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. 回答1: 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

resize uiview with UILabel and animate it correctly

*爱你&永不变心* 提交于 2019-12-07 07:33:41
问题 I have a UIView as container with a UILabel inside like this: ------------- --------- | | | | |Label text | |Label..| | | --> | | | | | | | | | | ------------- --------- Now when I use: UIView animateWithDuration:animations: and try to set the width smaller of the UIView (which contains the UILabel) then during the animation the UILabel suddenly replace with "..." without having smooth transition to it. I setup the UILabel autoresizingmask to UIViewAutoresizingFlexibleWidth,

why CGAffineTransformRotate in autolayout will shift the animated view?

房东的猫 提交于 2019-12-07 06:30:17
问题 I want to rotate a imageView using the following code: [UIView animateWithDuration:.25 animations:^{ self.imageView.transform = CGAffineTransformRotate(self.plusView.transform, M_PI_4); }]; the wired thing is that: if I run this code without auto layout, every thing is fine. but when using autolayout, the image view shift a litter pixel before rotate, why? 回答1: When using auto layout in Xcode 5, you need to add a constraint to fix the horizontal center and vertical center of the imageView in

Rotate a UIView infinitely until a stop method is called and animate the view back to its starting point

本秂侑毒 提交于 2019-12-07 02:04:28
I need to rotate a UIView indefinitely. However, I need to be able to stop it per a method, as I'm trying to implement something like a custom UIActivityIndicatorView . The view also needs to animate back to its starting rotation (0 degrees). The problem with all the approaches I've been trying to implement so far is that I'm either unable to stop it manually (until the duration ends), the animation isn't smooth or my view doesn't return back to its starting position. Basically, what I need is an animation to rotate my view forever. Once I call a method to stop it, it should return to its

How to force a raw value of 7 into a UIViewAnimationCurve enum?

淺唱寂寞╮ 提交于 2019-12-06 20:41:38
问题 The key UIKeyboardAnimationCurveUserInfoKey in the userInfo dictionary of a UIKeyboardWillShowNotification contains an Int with the value 7 . Now I need to pass this Int into UIView.setAnimationCurve(<here>) . I tried to create the required UIViewAnimationCurve enum like this UIViewAnimationCurve(rawValue: 7) . Because the raw value 7 is undocumented, the result is always nil . It works fine this way in Objective-C. Any idea how to get this animation curve from the notification into a UIView