core-animation

View based NSTableView with Core Animation

社会主义新天地 提交于 2019-12-12 20:04:09
问题 I have a view based NSTableView that contains cell views that have layers enabled. The NSTAbleView itself is also inside a view that has layers enabled. For some reason I just get a quick flicker of the table view cells when it first loads, and I have to scroll them in and out to make them appear. I just can't seem to figure out the reason why this is happening, are view based NSTableViews not supported with Core Animation (it just sounds strange to me if it isn't). In general I have problems

Implicit property animations do not work with CAReplicatorLayer?

一个人想着一个人 提交于 2019-12-12 19:20:42
问题 The sample code is here. After replacing explicit property animations with implicit property animations, the animation is broken. Explicit animation: -(void)animate:(id)sender { ... //Transform Animation animation = [CABasicAnimation animationWithKeyPath:@"transform"]; animation.fromValue = [NSValue valueWithCATransform3D: CATransform3DIdentity]; animation.toValue = [NSValue valueWithCATransform3D: t]; animation.duration = 1.0; animation.removedOnCompletion = NO; animation.fillMode =

CALayer initWithLayer: bound to default constructor by mistake? Can I override the default constructor?

こ雲淡風輕ζ 提交于 2019-12-12 19:20:23
问题 I cannot find any equivalent binded method for CALayer's initWithLayer:(layer) selector that I can override. Looking at the Monotouch Assembly, the selector initWithLayer is bound to the default constructor like so: [Export ("initWithLayer:")] public CALayer (CALayer other) { if (base.GetType () == typeof(CALayer)) { Messaging.intptr_objc_msgSend_intptr (base.Handle, CALayer.selInitWithLayer, other.Handle); } else { Messaging.intptr_objc_msgSendSuper_intptr (base.SuperHandle, CALayer

Fastest way to draw offscreen CALayer content

懵懂的女人 提交于 2019-12-12 18:54:38
问题 I'm looking for the fastest way to draw offscreen CALayer content (no alpha needed) on macOS. Note, that these examples aren't threaded, but the point is (and why I'm not just using CALayer.setNeedsDisplay) because I'm doing this drawing on a background thread. My original code did this: let bounds = layer.bounds.size let contents = NSImage(size: size) contents.lockFocusFlipped(true) let context = NSGraphicsContext.current()!.cgContext layer.draw(in: context) contents.unlockFocus() layer

animating a custom CALayer property

我们两清 提交于 2019-12-12 18:19:08
问题 I'm trying to define an abstract layer property, angle, based on the existing layer property position. Basically it describes the orientation of the layer from the center of a circle. I did like the following: @interface MenuItemLayer : CALayer @property CGFloat angle; @end @implementation MenuItemLayer + (BOOL)needsDisplayForKey: (NSString*)key { if ([key isEqualToString: @"angle"]) return YES; return [super needsDisplayForKey: key]; } - (void)drawInContext: (CGContextRef)context { [self

How do I determine if a CALayer is fully covered by other CALayers?

假如想象 提交于 2019-12-12 18:10:48
问题 I have a series of layers that are randomly placed on the screen. As each layer is added, it is positioned on top of all of the others. Eventually, a layer is completely covered by other layers. At this point, I'd like to remove the layer from memory. Is there any way to know when a layer is covered (either 100% or some fraction) by other layers? Each layer has a rotation transform applied to it, so I cannot accurately make comparisons amongst all of the layers' frames. 回答1: You could do a

Animation delay on left side of screen in iOS keyboard extension

放肆的年华 提交于 2019-12-12 13:19:03
问题 I'm working on a keyboard extension for iOS. However, I'm having some weird issues with animations / layers not appearing instantly on the far left of the screen. I use layers / animations to show a "tool tip" when the user presses a key. For all keys except A and Q the tool tips are displayed instantly, but for these two keys there seems to be a slight delay before the layer and animation appears. This only happens on touch down, if I slide into the Q or A hit area the tool tips gets

iPhone UITabBarController

梦想的初衷 提交于 2019-12-12 12:28:52
问题 I am using a UITabBarController with 3 items and am curious how to access a method from the first tab if I am on the second or third tab. The problem I am running into is I have a UIImageView on the first tab that is using core animation to loop continuously through 3 images. But when I switch to the second tab and try to switch back to the first tab the program hangs. I discovered if I stop the animation then it will let me switch back to the first tab fine. Any ideas? 回答1: You can access

Why the pause between animateWithDuration animation and completion blocks?

匆匆过客 提交于 2019-12-12 10:38:27
问题 Following Apple's recommendations, I'm chaining UIView animations by putting subsequent calls to -animationWithDuration:animation: in the completion: block of another call to aanimateWithDuration:animation:completion: , like so: [UIView animateWithDuration:scaleDuration delay:0 options:UIViewAnimationOptionCurveEaseIn animations:^{ // Scale the controllers' views down. self.view.transform = CGAffineTransformScale(self.view.transform, 0.8, 0.8); } completion:^(BOOL finished) { // Transition to

View-based NSTableView renders blank rows after inserting new rows with animation

五迷三道 提交于 2019-12-12 09:52:56
问题 I have a view-based NSTableView that I'm backing with an `NSMutableArray . Periodically I go out grab some data and want to insert new rows into the table at the top. When I do this without specifying an animation to insertRowsAtIndexes:withAnimation: it seems to work fine for hours on end. However, if I specify an animation, after about 7 or 8 inserts the table view starts to show blank rows where the inserts occurred. Scrolling down and then back up causes the new rows to render properly.