thomasguenzel
thomasguenzel

Reputation: 670

Cocoa User-Resizable Views

how can i achieve user-resizable views like in interface builder, so that the user can adjust some images by their own

Interface Builder Resizing

Do i have to manage all this manually with a view that watches mouse movement and so on?

Upvotes: 5

Views: 1084

Answers (2)

Rob Keniger
Rob Keniger

Reputation: 46020

You have to do all the work yourself. You will need to keep track of the objects in your view, their positions and do all the mouse tracking and view updating.

However, this is not actually very difficult, and Apple has provided a very complete example in its Sketch sample code.

Upvotes: 2

v1Axvw
v1Axvw

Reputation: 3054

I suggest drawing some buttons where you want the view to be resizable. Then start tracking mouse events in the view. Now, when a user drags its mouse while clicking on when of your spots, just change the view's frame accordingly. All of that should be possible to implement in a subclass of NSView.

Upvotes: 0

Related Questions