uiviewanimation

How to animate removeFromSuperview

淺唱寂寞╮ 提交于 2019-12-03 06:28:49
I animated the appearance of my subview with: CATransition *transition = [CATransition animation]; transition.duration = 0.3; transition.type = kCATransitionReveal; [webView.layer addAnimation:transition forKey:nil]; [self.view addSubview:webView]; But now I want to remove my subView. How can I add animation to do this? Like other CATransition? When to add this? Before or after addSubview? Krishnabhadra Well you could do the animation first and on the animationEndListener call removeFromSuperView [UIView animateWithDuration:0.5 delay:1.0 options: UIViewAnimationOptionCurveEaseOut animations:^{

How do I control the background color during the iPhone flip view animation transition?

强颜欢笑 提交于 2019-12-03 05:30:48
I have some pretty standard flipping action going on: [UIView beginAnimations:@"swapScreens" context:nil]; [UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft forView:self.view cache:YES]; [UIView setAnimationDuration:1.0]; [self.view exchangeSubviewAtIndex:0 withSubviewAtIndex:1]; [UIView commitAnimations]; To Apple's credit, this style of animation is amazingly easy to work with. Very cool, and I've been able to animate transitions, flips, fades etc. throughout the app very easily. Question : During the flip transition, the background visible 'behind' the two views during

Swift 3 UIView animation

雨燕双飞 提交于 2019-12-03 04:59:20
Since upgrading my project to swift 3 my autolayout constraint animations aren't working; to be more specific, they're snapping to the new position rather than animating. UIView.animate(withDuration: 0.1, delay: 0.1, options: UIViewAnimationOptions.curveEaseIn, animations: { () -> Void in constraint.constant = ButtonAnimationValues.YPosition.DefaultOut() self.layoutIfNeeded() }, completion: { (finished) -> Void in // .... }) I know they added the UIViewPropertyAnimator class but am yet to try it. I had this problem too with the newest update to swift 3. To be exact, whenever you want to

UIView animation options using Swift

♀尐吖头ヾ 提交于 2019-12-03 04:32:41
问题 How do I set the UIViewAnimationOptions to .Repeat in an UIView animation block: UIView.animateWithDuration(0.2, delay:0.2 , options: UIViewAnimationOptions, animations: (() -> Void), completion: (Bool) -> Void)?) 回答1: Swift 3 Pretty much the same as before: UIView.animate(withDuration: 0.2, delay: 0.2, options: UIViewAnimationOptions.repeat, animations: {}, completion: nil) except that you can leave out the full type: UIView.animate(withDuration: 0.2, delay: 0.2, options: .repeat, animations

How to animate the width and height of a UIView in Xcode?

折月煮酒 提交于 2019-12-03 03:59:07
问题 I have this subview I want to add to my main view, but make it expand from the origin. I read some of the Apple documentation but I don't understand where I am making mistake. I can animate the origin of the frame, i.e. to get it slide in from wherever, but the width/height doesn't seem to animate. Code as follows: [UIView beginAnimations:@"animateAddContentView" context:nil]; [UIView setAnimationDuration:0.4]; customView.frame= CGRectMake(self.view.frame.origin.x +5, self.view.frame.origin.y

How to animate UIImageViews like hatch doors opening

最后都变了- 提交于 2019-12-03 02:51:49
问题 I'm trying to create an animation that would look like 2 french doors (or 2 hatch doors) opening towards the user. I tried using the built in UIViewAnimationOptionTransitionFlipFromRight transition, but the origin of the transition seems to be the center of the UIImageView rather than the left edge. Basically I have 2 UIImageViews that each fill have the screen. I would like the animation to look like the UIImageViews are lifting from the center of the screen to the edges. [UIView

How to implement keywords associated function in swift?

馋奶兔 提交于 2019-12-03 01:05:07
问题 For example, when I input several letters, the corresponding words will show up automatically and then I can select them. But how to implement this kind of function? Which kind of UI element should I use ? Should I also input all countries in the world in cord data so that I can get the corresponding results ? 回答1: The image you've shown appears to be simply a UITableView that appears and is populated in response to what the user types in a UITextField. 回答2: If you're working with a table

Is there a way to use UIViewAnimationOptionTransitionCurlUp without it animating the entire screen?

我的梦境 提交于 2019-12-03 00:28:57
I have a view controller that has the following hierarchy: UIViewController | |-view |-presentView (UIView) |-stagedView (UIView) |-UIToolbar I am using the transitionFromView:toView:duration:options:completion: method to animate a page curl up to swap between the presentView and the stagedView . The present and staged view only cover most of the screen and there is a UIToolbar at the bottom. When I use the UIViewAnimationOptionTransitionCurlUp transition, it is animating the whole root view (toolbar included), not just the two views involved. [UIView transitionFromView:self.presentView toView

Highlighting a UIView similar to UIButton

混江龙づ霸主 提交于 2019-12-02 23:06:51
I have a UIView with a number of subviews and a Tap gesture recognized associated and I want to mimic it having a 'touch' effect. That is, when the tap happens, I want to show the container view to have a different background color and the text of any subview UILabels to also look highlighted. When I receive the tap event from UITapGestureRecognizer, I can change the background color just fine and even set the UILabel to [label setHighlighted:YES]; For various reasons, I cannot change the UIView to UIControl. But if I add some UIViewAnimation to revert the highlighting, nothing happens. Any

iPhone Flip Animation using UIViewAnimationTransitionFlipFromLeft in landscape mode

对着背影说爱祢 提交于 2019-12-02 20:53:06
I am working on one iPhone application in which I implemented one animation UIViewAnimationTransitionFlipFromLeft. Here my application works fine in the Portrait mode. It is doing the same animation as specified means Flip from Left to Right. But when I am doing this UIViewAnimationTransitionFlipFromLeft in landscape mode then it is not rotating from left to right. Instead of it is rotating from top to bottom. This is really critical issue. Can you help me out to solve this. The code I am using for iPhone application to rotate the view is as follows: CGContextRef context =