core-animation

Test whether a UIView is in the middle of animation

﹥>﹥吖頭↗ 提交于 2020-01-08 21:39:50
问题 Is there any way to tell if a UIView is in the middle of an animation? When I print out the view object while it is moving I notice that there is an "animations" entry: search bar should end editing: <UISearchBar: 0x2e6240; frame = (0 0; 320 88); text = ''; autoresize = W+BM; animations = { position=<CABasicAnimation: 0x6a69c40>; bounds=<CABasicAnimation: 0x6a6d4d0>; }; layer = <CALayer: 0x2e6e00>> When the animation has stopped and I print the view, the "animations" entry is now gone: search

Test whether a UIView is in the middle of animation

喜夏-厌秋 提交于 2020-01-08 21:39:24
问题 Is there any way to tell if a UIView is in the middle of an animation? When I print out the view object while it is moving I notice that there is an "animations" entry: search bar should end editing: <UISearchBar: 0x2e6240; frame = (0 0; 320 88); text = ''; autoresize = W+BM; animations = { position=<CABasicAnimation: 0x6a69c40>; bounds=<CABasicAnimation: 0x6a6d4d0>; }; layer = <CALayer: 0x2e6e00>> When the animation has stopped and I print the view, the "animations" entry is now gone: search

How do we accelerate animation if we are using images in iPhone SDK?

僤鯓⒐⒋嵵緔 提交于 2020-01-07 07:47:07
问题 I have series of images for animation, say Image 1 to 1000. I plan to show these images in a sequence at uniform rate to show animation. I want to know if there is a way by which I can accelerate the animation? Can I accelerate the rate of showing images? Please let me know. 回答1: Use GIF images to play animation. Playing GIF files with OpenGLES is the good practice and I believe it is the best way to play animation. Follow the Git Link: https://github.com/jamesu/glgif :) 回答2: There is so many

Can a CGImage be added to the contents property of a CAShapeLayer?

别来无恙 提交于 2020-01-06 18:08:36
问题 I have a custom view with a layerClass override like: + (Class) layerClass { return [CAShapeLayer class]; } I want to be able to add a CGImage to the contents property like so: - (void) animateView { UIImage *layerImage = ...; CAShapeLayer *layer = (CAShapeLayer *)self.layer; layer.contents = layerImage.CGImage; //....Do other fun animations here } Are there other properties I need to set, or other ways to get the shape layer to render the contents of the image for animation? 回答1: I would

iphone - Where to put code regulating CALayer animation?

本小妞迷上赌 提交于 2020-01-06 14:56:19
问题 I have managed to draw a bar in the drawInContext method of my custom layer, PatternLayer. However, I would like to animate three things and am confused about where I can place the custom animation regulation code. Here is the interface of my custom layer: @interface PatternLayer : CALayer @property (nonatomic) CGFloat percentage; @property (nonatomic) CGFloat shineProgress; @property (nonatomic, strong) UIColor* barColor; @property (nonatomic) CGFloat strokeWidth; @property (nonatomic,

Flip and zoom 3D transition problems (iOS 7+)

六月ゝ 毕业季﹏ 提交于 2020-01-06 09:03:32
问题 I'm trying to build transition for card flip & zoom. I've made its model in Origami - Movie (less that 1Mb) As you can see there are 3 transforms applied at the same time: 1. moving center of the view to the centre of the screen 2. scaling 3. 3D rotte We can divide animation on equal 2 phases: Phase 1: Button scales, moves and rotates on the side (PI/2 radians). At the end of Phase 1 button disappears. Phase 2: toView (my modal view) rotates (from -PI/2 to 0 radians), scales up to the normal

Flip and zoom 3D transition problems (iOS 7+)

泪湿孤枕 提交于 2020-01-06 09:02:57
问题 I'm trying to build transition for card flip & zoom. I've made its model in Origami - Movie (less that 1Mb) As you can see there are 3 transforms applied at the same time: 1. moving center of the view to the centre of the screen 2. scaling 3. 3D rotte We can divide animation on equal 2 phases: Phase 1: Button scales, moves and rotates on the side (PI/2 radians). At the end of Phase 1 button disappears. Phase 2: toView (my modal view) rotates (from -PI/2 to 0 radians), scales up to the normal

CALayer not rendering when added after view visible

倾然丶 夕夏残阳落幕 提交于 2020-01-06 05:00:17
问题 I'm probably just missing something really simple but whenever I add CALayers after the view is visible they don't render. Here's the code I'm using: [[imageLayers objectAtIndex:0] removeFromSuperlayer]; [imageLayers removeObjectAtIndex:0]; [[imageLayers objectAtIndex:0] removeFromSuperlayer]; [imageLayers removeObjectAtIndex:0]; firstImageOffset = (firstImageOffset + 2) % [pieceCache count]; int topIndex = (firstImageOffset + 6) % [pieceCache count]; int bottomIndex = (firstImageOffset + 7)

CALayer not rendering when added after view visible

ⅰ亾dé卋堺 提交于 2020-01-06 05:00:06
问题 I'm probably just missing something really simple but whenever I add CALayers after the view is visible they don't render. Here's the code I'm using: [[imageLayers objectAtIndex:0] removeFromSuperlayer]; [imageLayers removeObjectAtIndex:0]; [[imageLayers objectAtIndex:0] removeFromSuperlayer]; [imageLayers removeObjectAtIndex:0]; firstImageOffset = (firstImageOffset + 2) % [pieceCache count]; int topIndex = (firstImageOffset + 6) % [pieceCache count]; int bottomIndex = (firstImageOffset + 7)

How to add UIView subviews in a view aligned like 3x3 table

南楼画角 提交于 2020-01-05 14:11:29
问题 I have created a main View and in that I add 9 UIMyView that I subclassed from UIView. I add instances of that UIMyViews using NSBundle to load the nib file and addSubview in the main view controller, of course all of these views are appeared in the upper left corner of the super view one hiding the other and the last one to be visible, which either I need to position them somehow using points in super view or create something like a table and add to its cells the UIMyViews?! Imagine you have