uiviewanimation

iOS: a Complete 360 Degree-Rotation Using Block, Not CABasicAnimation

倖福魔咒の 提交于 2019-11-30 06:47:07
问题 It should be something really simple, but I have not been successful in getting this to work using blocks. There are questions and answers to this, but all of them I found are solved by the use of CABasicAnimation and not by UIView Block-Based Animation, which is what I am after. The following code doesn't work (Block-Based), no animation: CGAffineTransform spin = CGAffineTransformRotate(spiningView.transform, DEGREES_RADIANS(360)); CATransform3D identity = CATransform3DIdentity;

Animated Images in a UIButton

可紊 提交于 2019-11-30 06:47:05
What is the best way to animate images of a button? Say I want to cycle through like 6 frames and have the user still be able to click the button? Should I animate the images and just have an invisible button on top of it in interface builder? Is there a way to animate them within defining the UIButton ? Or is it better to animate images and find the users touch point and act on that? You can do this using the imageView property of UIButton . This will allow the button to behave as it normally would with your images animating on it. Here's an example: NSMutableArray *imageArray =

Synchronizing Animations in keyboardWillShow keyboardWillHide — Hardware Keyboard & Virtual Keyboard Simultaneously

感情迁移 提交于 2019-11-30 04:56:34
Preamble So I have an application featuring a chat section, and I'm synchronizing the animation of the keyboard hiding and showing with the rise and fall of the chat input. Here's the code I'm using: SHOW: - (void) keyboardWillShow:(NSNotification *)note { NSDictionary *keyboardAnimationDetail = [note userInfo]; UIViewAnimationCurve animationCurve = [keyboardAnimationDetail[UIKeyboardAnimationCurveUserInfoKey] integerValue]; CGFloat duration = [keyboardAnimationDetail[UIKeyboardAnimationDurationUserInfoKey] floatValue]; NSValue* keyboardFrameBegin = [keyboardAnimationDetail valueForKey

Animate collection view cells [closed]

妖精的绣舞 提交于 2019-11-30 02:32:22
How to animate collection view cells like a closing or a sliding from the left-right door in iOS. like this: This is code for animation collection view cells like a closing door. This collection has 2 columns. I have added code for UICollectionViewDelegateFlowLayout methods for collection view cell sizes. You can customize it or change it as per your requirement. This code shows a simple way to generate animation like a closing door. // MARK: - UICollectionViewDelegateFlowLayout extension SettingsViewController: UICollectionViewDelegateFlowLayout { func collectionView(_ collectionView:

Having problems allowing interaction in UIView animation

风流意气都作罢 提交于 2019-11-29 23:21:00
问题 I have the following block of code to fade out an introView(UIView) // Hide intro view after 5 seconds [UIView animateWithDuration: 1.0 delay: 5.0 options: (UIViewAnimationOptionAllowUserInteraction |UIViewAnimationOptionCurveLinear) animations: ^{ introView.alpha = 0; } completion: ^(BOOL finished) { [introView removeFromSuperview]; }]; I have a skip button inside the introVew but there is no interaction whatsoever, am I missing something? I have to add this is a Universal app targeting 3.2

Stop an auto-reverse / infinite-repeat UIView animation with a BOOL / completion block

☆樱花仙子☆ 提交于 2019-11-29 16:15:00
问题 I'm setting up the following UIView animateWithDuration: method, with the intention of setting my animationOn BOOL elsewhere in the program to cancel that infinite looped repeat. I was under the impression that the completion block would be called each time a cycle of the animation ends, but this doesn't appear to be the case. Is the completion block ever called in a repeating animation? And if not, is there another way I can stop this animation from outside this method? - (void) animateFirst

Animating UIView doesn't working as expected

三世轮回 提交于 2019-11-29 12:40:00
In my application i am using a UIView which includes UITableView , Buttons and Labels in it. It created using Storyboard . When user click a navigation bar button UIView will appear with animation from top to certain height and if they click it again it hides the UIView with animation(From that height to top). Same like UIActionView . It works fine if there is no records in UITableView . But if it has any records, while calling [self hideBasket] the UIView appears from bottom of the view to top(Not Hidden). // Hide Basket Code -(void)hideBasket{ /*Finished Hiding the Basket [self.view

UIView touchesbegan doesn't respond during animation

两盒软妹~` 提交于 2019-11-29 07:05:07
I have a draggable class that inherits UIImageView. The drag works fine when the view is not animating. But when animating it won't respond to touches. Once the animation is completed the touch works again. But I need it to pause the animation on touches and resume when touch ends. I spent the whole day researching it but couldn't figure out the reason. Here is my animation code. [UIView animateWithDuration:5.0f delay:0 options:(UIViewAnimationOptionCurveLinear | UIViewAnimationOptionAllowUserInteraction) animations:^{ self.center = CGPointMake(160,240); self.transform =

How to Make a Secret iOS App Text Animation

感情迁移 提交于 2019-11-29 03:01:06
问题 I'm trying to duplicate the Secret App's Text Label transition. Does anyone the best way to approach it? It looks like they have each letter start out as clear text color and then animate it to gray and then white text color. Here are some screenshots: 回答1: Here is another solution https://github.com/zipme/RQShineLabel I use CADisplayLink together with NSAttributedString that way we only need one UILabel, have a look :) 回答2: Thanks everyone for the help. I was able to get this working with

How to cancel UIViews block-based animation?

喜夏-厌秋 提交于 2019-11-29 01:16:13
i currently focus the following problem: i start an animation, where 2 objects-attributes are triggered. the code is: [UIView animateWithDuration:0.3 animations:^{ greyscaleImage.alpha = 1; activityIndicator.alpha = 1; } completion:^(BOOL f){ if(f) { [activityIndicator startAnimating]; } }]; which works fine. the only problem i discovered is, that i have a 0.3 seconds change to crash the app when the view which holds this activityIndicator and greyscaleImage is deallocated. To make it more clear please imagine a ViewController, its view presented via default iOS-modal-View ways. Now trigger