I've just started playing with NSAnimation and Core Animation, but I can't seem to animate a NSImage sliding in from offscreen (I also can't get a rotating animation to work, but that's a different question). When I initialize the NSImageView (with the NSImage set to its image property) outside of the window no image is displayed. What exactly am I doing wrong to cause the NSImage to not redraw?
imageView = [[NSImageView alloc] initWithFrame:NSMakeRect(-818, 0, 818, 494)];
NSImage *image = [NSImage imageNamed:@"image.png"];
[imageView setImage:image];
[mainView addSubview:imageView];
NSRect outFrame = NSMakeRect(678, 0, imageView.frame.size.width, imageView.frame.size.width);
CABasicAnimation *animation = [CABasicAnimation animation];
animation.toValue = [NSValue valueWithRect:outFrame];
NSView *view = self.window.contentView;
view.animations = @{@"frame" : animation};
[[view animator] setFrame:outFrame];