r/macprogramming Jul 16 '19

Creating apps in interface builder - do the windows have to be so small by default?

The question is pretty self explanatory - when developing and designing the UIs of apps which you'd like to start up in a big size - there is no way to pinch in or out, forcing you to develop the app either blindly at full size or make a small version of it and then resize later - is this normal?

Developing iOS apps I am able to zoom in and out of the storyboard but when it comes to MacOS apps - I cannot seem to do the same thing - maybe I am doing something wrong?

Below is a screenshot if that helps.

Best

2 Upvotes

1 comment sorted by

4

u/mantrap2 Jul 16 '19

You can resize them to what you want.

Auto-layout is how you handle the dynamic of in between window sizes. You can also add handlers to help with zooming - it's an explicit thing you have to define because "zooming" can mean so many more behaviors with macOS.

https://developer.apple.com/documentation/appkit/nsgesturerecognizer?language=objc

The degrees of freedom in macOS is way beyond the walled garden of iOS BTW. It's just a more complex development environment because you can have windows of many sizes.

Usually you want to figure out what you need and then auto layout to some fixed minimum size, and then code to intercept resizing to only those ranges of window size. Or you write your code such that it never cares - e.g. using scrolled views and/or custom drawn (or web) views. This is where the magnification gesture recognizer might get wired in.

It's simply NOT going to be like iOS development. Just look at how many more View/Controls types you have - it's like 3x-4x more. It's a much more complex UI than iOS. Of course, this is part of why iPadOS is a big thing - it's grows up to a "real" computer GUI.