Edit AllPages

Sometimes, it’s really boring to be a newbie. I made a NSView (inside a NSScrollView) with IB. Then i’m dynamically adding subviews in it from top to bottom (see AutomatorLikeUI). At this time everything is working good. But obviously, as the Y axis is ‘inverted’, when a subview reach the bottom of the view, i had to deal with the scrollview. Here what i wrote :

yPos is used to memorize the bottom of the last added subview and topOfView is just my view’s y origin + my view’s height. So addBlocOfHeight: is increasing the framerect and allow me to scroll the view. The problem is it’s adding space on the top of the view, not at the bottom so the scroll shows me white at the of the view and the subviews are cut at the bottom… What should i do? Do i have to completely change the way i did it? - StephaneDassieu. —- You’re expecting all of your views to be still relative to the top of your view. The problem is that the default autoresizing mask makes views be still relative to the bottom of your view. Try something like this right after you create the new view:

[bloc setAutoresizingMask:NSViewMinYMargin];

That should tell it to make the bottom space flexible and stick to the top, and then your code will hopefully work correctly.

Ahh i did find a simple way by myself (after carefully reading the Apple doc about Drawing and Views It looks like i just have to overide the isFlipped method in my view subclass:

So the y-axis runs from top to bottom. Easy!

yeah - the resizing mask is the right way to do this. flipping a view affects a lot more than just sizing behavior. –> Can you quickly explain what it affects?