setImage animated - NSImageView - objective-c

I'm trying to setImage: of a NSImageView using animation (Mac App):
[[_image animator] setImage:[NSImage imageNamed:#"image.png"]];
But the image is just changing (without some effect). I'm trying to fade it.
Any idea how to fade two NSImageView in a Mac App?

I think this link might help you with transitions and animations with NSImageView :
http://developer.apple.com/library/mac/samplecode/ImageTransition/ImageTransition.zip
Hope this helps

Related

How to stretch Image in OSX app?

I want to stretch an Image to fit a view. In iOS I have used this function.
[myImage stretchableImageWithLeftCapWidth:12 topCapHeight:13];
This stretches the image correctly and doesn't distort its edges and corners. In OSX app development I am using NSImage and NSImageView. Is there any OSX equivalent way of achieving this? If it can be achieved through storyBoards then it will be wonderful.
You could simply set the imageScaling. Apples Documentation gives you the following options;
NSImageScaleProportionallyDown
NSImageScaleAxesIndependently
NSImageScaleNone
NSImageScaleProportionallyUpOrDown
If you just want to stretch the image to fit the NSImageView you can do something like this.
Swift
let imageView = ...
imageView.imageScaling = .ImageScaleProportionallyUpOrDown
Objective-C
NSImageView *imageView = ...;
[imageView setImageScaling: NSImageScaleProportionallyUpOrDown];

Change background image on all scenes iOS 7

The storyboard looks like the image below. In each scene I had to drag an UIImage object from the object library, size it to fit between the nav and tab bars then set its image to that baige blur with the attributes inspecter.
I'm curious, is there a way to do it in one go to all scenes from the appdelegate.m file? thanks
Try this in your AppDelegate:
[self.window setBackgroundColor:[UIColor colorWithPatternImage:[UIImage imageNamed:#"whatever.jpg"]]];

NSClipView weird background image in NSScrollView

I'm trying to get a transparent background on my NSTableView, however, it seems as though the NSClipView nestled inside the NSScrollView is causing weird background problems, where it seems it's redrawing the background of the main NSView inside the NSClipView.
I've done all this in an attempt to remove it, but it's just not happening:
[[self.scrollView contentView] setCopiesOnScroll:NO];
[[self.scrollView contentView] setDrawsBackground:NO];
[self.scrollView setDrawsBackground:NO];
[self.scrollView setCopiesOnScroll:NO];
Any help would be greatly appreciated.
Regards,
Mike
Found the answer. When creating the background image in the NSView subclass, change the bounds of the drawInRect from dirtyRect to self.bounds. Works a treat.

Flip vertical UIWebview to be shown when view did load

I was searching information to show a uiwebview using a flip horizontal effect like modal transition one in viewDidLoad event, but I wasn't successful, even in apple documents. Can anybody help me with that?
Many thanks
the transition to animate webView with the view add your webView like this.
[UIView transitionWithView:poster.view duration:3
options:UIViewAnimationOptionTransitionFlipFromLeft animations:^{
[self.view addSubview:yourWebView];
}
completion:NULL];
The animation you want to add can be done on the UIView. So you should addSubView the UIWebview to the UIView and then do the animation on the UIView.

Animate setContent of an NSWindow

In the past I've been successfully able to fade in an NSWindow using the following code;
if (![statusWindow isVisible])
{
statusWindow.alphaValue = 0.0;
[statusWindow.animator setAlphaValue:1.0];
}
CAAnimation *anim = [CABasicAnimation animation];
[anim setDelegate:self];
[statusWindow setAnimations:[NSDictionary dictionaryWithObject:anim forKey:#"alphaValue"]];
[statusWindow makeKeyAndOrderFront:self];
For my current project I'm trying to make a flash similar to the one in Photo Booth. I've created a white NSPanel and was planning to set my NSWindow's content to the panel, and quickly set it back.
Is it possible to set the contentView of an NSWindow using a nice fade effect?
P.S - If there is an easier way you know of how to achieve the flash, please tell me!
Thanks in advance,
Ricky.
Why use another window? It looks like you're trying to use CoreAnimation already so why not just add a white CALayer to your existing view and animate its opacity?