core-animation

wrong orientation on UIViewController while animating it

萝らか妹 提交于 2019-12-06 06:45:33
问题 In order to use a UISplitViewController, I'm replacing my window root controller when navigating from one view controller to the other. In order to have some nice transition while doing so, I'm using a zooming effect like this: MyOtherViewController *controller = [[MyOtherViewController alloc] initWithNibName:@"MyOtherView" bundle:nil]; UIWindow *window = ((MyAppDelegate *)[[UIApplication sharedApplication] delegate]).window; controller.view.frame = [window frame]; controller.view.transform =

Blur CALayer's Superlayer

二次信任 提交于 2019-12-06 06:07:26
I've got a CALayer and a sublayer in it. What i want to achieve is a blur of the superlayer (the area under the sublayer), just like the standard sheets do it. I've tried to set a .compositingFilter on the sublayer but this doesn't seem to work. Any ideas how to solve this? Code from the sublayers init: CIFilter *blur = [CIFilter filterWithName:@"CIGaussianBlur"]; [blur setDefaults]; self.layer.backgroundFilters = [NSArray arrayWithObject:blur]; The above should work fine, depending on the context it is used in. E.g. with a simple super-layer containing an image, the following works for me:

How to use a CIFilter on the layerClass instance of an UIView?

ⅰ亾dé卋堺 提交于 2019-12-06 04:23:23
问题 My UIView is using an instance of TBPaperLayer for its layer. +(Class)layerClass { return [TBPaperLayer class]; } I would like to create a CIFilter to modify the appearance of this layer - especially apply a blur filter on it. How can I use this code to blur a part of this layer ? (code from: Blur CALayer's Superlayer) CALayer *blurLayer = [CALayer layer]; CIFilter *blur = [CIFilter filterWithName:@"CIGaussianBlur"]; [blur setDefaults]; blurLayer.backgroundFilters = [NSArray arrayWithObject

How to make a CATransform3dMakeRotation rotate the other way? And chain together

旧城冷巷雨未停 提交于 2019-12-06 04:22:41
问题 I'm working with some Core Animation for the first time and in the process of implementing a playing card that I can flip around, I've decided to use a CALayer to display the contents (not sure how I'm going to get two sides, but that's another question) and I need to be able to flip it over, move it, etc... I'm using CATransaction with some success - in the snippet below, the card moves from the bottom left to the top left and flips over. The problem is that I wan't it to flip the opposite

Draggable CALayer

此生再无相见时 提交于 2019-12-06 03:28:46
Any way of making a CALayer draggable by the user? If so, how? (In Cocoa - Mac) Layers can not receive mouse events themselves. You would have to do the event handling in the view or view controller containing the layer. If a mouseDragged: event originates on a layer (see -[CALayer hitTest:] and -[CALayer containsPoint:] to test this), adjust the layer's position accordingly. You will probably want to disable implicit animations to have the layer follow the mouse pointer immediately (rather than lagging a little behind because of the animation of the position property): [CATransaction begin];

Using CATransform3D to create flip animation

感情迁移 提交于 2019-12-06 03:21:51
I'm trying to recreate UIViewAnimationTransitionFlipFromRight (and left). My reason for doing so, as shown below, is to make changes to AVCaptureVideoPreviewLayer in the middle of the animation, when the layer is obstructed. UIViewAnimationTransitionFlipFromRight won't let me stop the animation half way, make session changes, and continue, so here is my best shot at it. While this works, it's just not the same as UIViewAnimationTransitionFlipFromRight. The layer starts to rotate, but more of a slide, backwards and diagonally (very hard to describe), and then reverses for the second part of the

NSOutlineView expand / collapse animation from code

我是研究僧i 提交于 2019-12-06 03:17:49
问题 i'm wondering how does one animate the expansion/collapse of an NSOutlineView's tree node from code ? // this works ok but doesn't animate NSTreeNode *node = [self.outlineView itemAtRow:self.outlineView.clickedRow]; if([self.outlineView isItemExpanded:node]) { [self.outlineView.animator collapseItem:node]; }else{ [self.outlineView.animator expandItem:node]; } an outline view naturally animates if you expand a node via the default-drawn arrow so there IS a way... 回答1: My original code was OK,

Animations disappear in iOS application after some time

。_饼干妹妹 提交于 2019-12-06 02:51:22
问题 After several minutes running all animations in my application disappeared, even system animations like alert animation and UINavigationController animations. What can be the issue? P.S. I dont use [UIView setAnimationsEnabled] anywhere. 回答1: Well, the answer is - system sometimes disables animations, and, normally, it enables them back on. But in my case, for some reason, it failed to set them back enabled. And this happens only during transitions between UIViewControllers. What I came up

Internal implementation of UIView's block-based animation methods

大城市里の小女人 提交于 2019-12-06 02:09:28
问题 Ever since their introduction in iOS 4, I have been wondering about the internal implementation of the UIView 's block-based animation methods. In particular I would like to understand what mystical features of Objective C are used there to capture all the relevant layer state changes before and after execution of the animation block. Observing the black-box implementation, I gather that it needs to capture the before-state of all layer properties modified in the animation block, to create

What's the easiest way to animate a line?

风格不统一 提交于 2019-12-06 00:22:02
问题 I am creating an app that involves animating lines within a workspace over time. My current approach for this is to use code like this in drawRect : CGContextSetStrokeColor(context, black); CGContextBeginPath(context); CGContextMoveToPoint(context, startPoint.x, startPoint.y); CGContextAddLineToPoint(context, finalPoint.x, finalPoint.y); CGContextStrokePath(context); ...and then just setting a timer to run every 0.05 seconds to update finalPoint and call setNeedsDisplay . I'm finding this