Zooming NSScrollView like Preview.app
===

I want to implement zoom that works like an image opened in Preview.app, that does the same when zooming out and in. I have tried different ways but can't get it 100% correct, I have tried Apple's IKImageViewDemo but it doesn't work like Preview. Does someone know about a tutorial, example or something that could help?