This is because the co-ordinate system in Cocoa starts from the bottom left corner. i.e the co-ordinates (0,0)
is at the bottom left corner of the screen/parent view. So the increment in y co-ordinate (height) would increase the size upwards. What you should do is as you increment the height, shift the origin downwards, For e.g. if you want to increase/decrease the frame height to 90;
CGFloat heightDiff = 90 -self.frame.size.height;
NSRect rect = self.frame;
rect.size.height = 90;
rect.origin.y -= heightDiff;
self.frame = rect;
That should do it.
Override the parent view's isFlipped
and not the method of the view itself for the expected behavior.
For instance if you are adding it to the content view of window
, sub class the windows contentView
and override its isFlipped
method to return YES
.