NSImageView Unproportional Zoom
2017-02-10
I had this weird problem when I tried to implement a zoom functionality
in my hobby project, a manga reader called Yomu.
When I tried to zoom an NSImageView
programmatically
it's being zoomed unproportionally, my expectation was the image should be stretched horizontally
and vertically without moving from its center point. It was like this
Zoom 100%
Zoom 140%
Damn, there was an ugly gap :( between header border and the image. I had a hard time finding the solution, it took me almost 3 days to debug this problem (maybe because I'm a newbie). It turns out the solution is really simple, by default apple will set image view to scale proportionally down, changing it to proportionally up or down will fix the problem.
The culprit T_T
Fixing it 🍻