core-animation

My presentation layer does not match my model layer even though I have no animations

此生再无相见时 提交于 2019-12-10 18:55:42
问题 On iPhone I have a CALayer that I animate via Core Animation. Then at some point I change view controllers. I then return to the view controller with the CALayer and in viewWillAppear: I set the frame and position properties on my layer to move it back to its starting point. Setting these properties changes the model layer but the presentation layer still has the old values and its presentation layer does not update until the next animation I play. In the CA Programming guide it says : "You

Simple example of CALayers in an NSView

℡╲_俬逩灬. 提交于 2019-12-10 17:41:50
问题 I am trying to add several CALayers to an NSView but my view remains empty when shown: Here is my code: - (id)initWithFrame:(NSRect)frame { self = [super initWithFrame:frame]; if (self) { self.layer = [CALayer layer]; self.wantsLayer = YES; CALayer *newLayer = [CALayer layer]; NSImage *image = [NSImage imageNamed:@"page.png"]; newLayer.backgroundColor = [NSColor redColor].CGColor; newLayer.contents = (id)[image CGImageForProposedRect:NULL context:NULL hints:nil]; newLayer.frame = NSMakeRect

Animating CAGradientLayer's locations property in a UIScrollView mask resets after completion

情到浓时终转凉″ 提交于 2019-12-10 17:35:17
问题 I'm trying to animate the locations of a CAGradientLayer to shrink when the UIScrollView has reached a certain position. I have my gradient set up as a mask of the UIScrollView , and adjust the gradient's locations property to expand a bit as the scroll view scrolls. This works just fine for me, except when I try to animate a change to the locations. When I perform the animation - either as an explicit CABasicAnimation or implicitly - the animation performs correctly, but for whatever reason,

Animate CALayer mask change with fade effect

五迷三道 提交于 2019-12-10 17:28:22
问题 I have a UIView , with view.layer.mask set to an instance of CAShapeLayer . The shape layer contains a path, and now I want to add a hole to this shape by adding a second shape with even/odd rule, and fade-in the appearance of this hole. The problem is that adding to path doesn't seem to be animatable: [UIView animateWithDuration:2 animations:^() { CGPathAddPath(parentPath, nil, holePath); [v.layer.mask didChangeValueForKey:@"path"]; }]; How would I animate this? 回答1: After some fiddling,

CABasicAnimation stops when relaunching the app

≯℡__Kan透↙ 提交于 2019-12-10 17:24:30
问题 I am running into a problem where a restart of my iPhone app causes animations to stop. More specifically, I have the following animation set and running: CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"path"]; animation.duration = 1.0; animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseInEaseOut]; animation.repeatCount = 1e100f; // Infinite animation.autoreverses = YES; animation.fromValue = animationStartPath; animation

SIGABRT message only with iOS5

冷暖自知 提交于 2019-12-10 16:25:56
问题 I'm facing a strange crash of my app that occurs only with iOS5. The problem seems to be with my core animation method bellow, because when I set no value for aAnimation.repeatCount or 0 it is working, but when it rotates I use get SIGABRT message with error: -[NSConcreteValue doubleValue]: unrecognized selector sent to instance 0x9628100 when I touch device/simulator screen. any help will be appreciated My view definition - (void)loadView { CGRect screenRect = [[UIScreen mainScreen]

NSTableView redraw not updating display, selection sticking

我的梦境 提交于 2019-12-10 15:46:13
问题 Although I know of a solution to this problem, I am interested if someone can explain this solution to me. I also wanted to get this out there because I could not find any mention of this problem online, and it took me several hours over several days to track down. I have an NSTableView behaving strangely regarding redraws and its selection. The problem looks like this: Table contents fades in, instead of appearing instantly upon it's appearance on screen. When scrolling through the contents,

Why does calling my CABasicAnimation not work in viewDidAppear?

懵懂的女人 提交于 2019-12-10 15:42:39
问题 In viewDidAppear I call the following code: MyView *myView = [[MyView alloc] initWithFrame:CGRectMake(100, 100, 100, 100)]; myView.backgroundColor = [UIColor clearColor]; [self.view addSubview:myView]; [myView setProgress:0.3 animated:YES]; That last line calls this method: - (void)setProgress:(CGFloat)progress animated:(BOOL)animated { self.innerPie.hidden = NO; self.innerPie.strokeEnd = progress; CABasicAnimation *pathAnimation = [CABasicAnimation animationWithKeyPath:@"strokeEnd"];

smooth animation in iOS using CoreAnimation

不羁岁月 提交于 2019-12-10 15:34:04
问题 CoreAnimation is a pretty easy thing, but: [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:30]; MyImageView.frame = CGRectOffset(MyImageView.frame, 100, 0); [UIView commitAnimations]; I want to move the ImageView by 100 Pixel veeeery slowly. Therefore all positioning values are double I expect the Layoutsystem to position the items with subpixel accuracy. Butt when I watch this animation i see the ImageView "jumping" pixelwise instead of a smooth traveling. Any ideas

How to animate a png sequence with core animation in cocoa (not touch)

纵饮孤独 提交于 2019-12-10 15:29:11
问题 I would like to animate a png sequence in a NSImageView, but I cannot make it work. It just does not want to show any animation. Any suggestion? This is my code: - (void) imageAnimation { NSMutableArray *iconImages = [[NSMutableArray alloc] init]; for (int i=0; i<=159; i++) { NSString *imagePath = [NSString stringWithFormat:@"%@_%05d",@"clear",i]; [iconImages addObject:(id)[NSImage imageNamed:imagePath]]; //NSImage *iconImage = [NSImage imageNamed:imagePath]; //[iconImages addObject:(__bridge