NSScrollView and lion .. is it possible to only show scrollbars when scrolling - cocoa

Is it possible to have an NSScrollView ignore the system preferences setting and only show scrollers when scrolling. My application is designed for the overlay style scrollers only unfortunately, so I want to avoid having to adjust the containing content views.
Is this possible?

I would take a look at NSScroller's setScrollerStyle:. That should do the job.
However, I'd like to share that I personally think forcing users into using one style of scrollers over the other is indicative of bad design. The system allows users to choose and I believe apps should honor that choice. The fact that your content view doesn't handle horizontal nor vertical resizing is a big red flag and I would revisit that design choice.
Good luck.

Related

Set the width of a scrollbar in wxWidgets on Windows

I'm looking for a way to set the width of the scrollbar in may class which inherits from wxScrolledWindow. I wouldn't mind editing the framework source code (3.1.0). I've looked there but I could not find the solution for my problem since the wxScrolledWindow and its base classes don't seem to use the wxScrollBar class.
You can't change the width (or any other aspect of the appearance) of the standard scroll bars, used for scrolling a window -- this is part of the native look-and-feel you get when using wxWidgets.
If you absolutely need to do something different (why?), you have no choice but to write your own scrolled window class using a plain window without scrollbars and one or two standalone wxScrollBars for scrolling it. Needless to say, this is going to be complicated and won't work as well as native scrolling, so you shouldn't do it unless you really can't live without this.

Do we need autolayout and constraints for an OSX app that has a fixed interface size?

Think before you answer because this question may be deeper than it appears.
Do we really need autolayout and constraints for an OSX app that has a fixed interface size?
The only reason for constraints and autolayout on iOS is the different sizes when you rotate the application or between devices but on OSX the reason may be scaling the interface, because there is no rotation. In this specific case the interface has a fixed size.
You interface is really fixed? No resizable windows or anything? If so, nope, you totally don't need autolayout. Just disable the "Use Auto Layout" checkbox in the File Inspector for your xib. That will allow you to use the old-fashioned Autoresizing masks, which, if your app truly has a fixed interface size, you don't even need that.
Layout your interface in IB however you like, and you're done.
I'm not sure if I thought deep enough or onderstand the interface builder enough, but I found out that the buttons keep the size I want them to if I use the constraints. Without constraints and word wrap on, your (my) buttons resize to fit around the text.
Also when you need to resize subviews to fit the content they're showing and you don't have constraints set, you tend to get a messy interface inside your window. My experience is that constraints not only help you when your window resizes. It keeps your interface objects placed correctly in position of one another and with the right size even when content in the different view objects change.

Scrollable large NSDocument on Macbook Pro 13" XGA display

I'm having all kinds of trouble understanding how NSWindows can have larger documents than the window bounds in them.
Unfortunately, layout and contents prevents me from simply shrinking the document (and I wouldn't want to make the layout cramped for those with larger screens).
A school needs to run this app on their new 13", non-retina MacBook Pros. Scrolling is acceptable to them, but I'm unsure as to the approach, and I'd like your advice on the best way to handle this to avoid forced scrolling on larger screens.
I've tried setting the NSWindow min and max size and embedding the document in a Scroll View. But even though you can see part of the document view sticking out, no scroll bars appear (I have set them to Always in sys prefs).
If this is the way to go I would appreciate a link to a tutorial on this exact subject, because I'm a bit lost with all the measurements and options.
If not I'd like a pointer where to start and what to read. I'm experienced with Cocoa Touch but a relative newcomer to Mac development.
Without more information it sounds like you have embedded a NSScrollView but didn't set up the springs and struts properly to allow the scroll view to resize when its parent view (assuming it's the window) resizes.
You might want to check out Specifying a View’s Behavior as Its Container Resizes in the Interface Builder Help documentation.

Xcode Storyboard Zoom Magnification

I'm currently using the storyboard feature to position views. Due to the nature of these views, they need to be positioned with precision.
I'd like to view the Storyboard Scene/View in a magnification/zoom level greater than 100%, but it doesn't seem to be possible using the standard zoom in/out feature.
Is it possible to do this?
Note - I understand how to use the 'Size Inspector'.
It doesn't look like there is a way to do this, but there is at least one alternative that works fairly well:
Go to System Preferences > Accessibility > Zoom
Turn on the keyboard shortcut or scroll gesture
You should now be able to zoom in on any part of the operating system, including storyboards.
To make editing even easier, enable these options, some of which are found under More Options...:
Turn off Smooth images
Change Zoom Style to Picture-in-picture
Window Position: Follow mouse cursor
Cursor style: Crosshair
Enable temporary zoom
No, I am almost positive it is not possible to do this. You are stuck with 100% zoom. However, if you need great precision, you could try selecting the element you wish to move and use the arrow-keys to move the item around accurately.
However, like MacN00b, I do not use Storyboards a lot, so perhaps there is some top-super-secret setting buried somewhere.
This is one of the reasons I don't use storyboard but prefer good old fashion individual xibs. I don't think it is possible to zoom in past 100%, you may try double clicking on the background, I know that normally zooms in.

How to add left/bottom/right panes to Mac application as in XCode?

XCode 4 (but also iTunes and other Mac apps) provide side or bottom bars that can be shown or hidden with a smooth animation as the user presses a button.
How can I obtain a similar effect in my applications?
You can use NSSplitView to do that. You can have more than 2 subviews in a split view (left|center|right) and you can build a kind of hierarchy for the different bars (center consists of top and lower split views).
The show/hide effect is not built in, though. But you should be able to use the animator to do that. Most certainly you can also define animations for hiding a view.
You could also use the BWSplitView of http://brandonwalkin.com/bwtoolkit/ where the show/hide animation is already included.
You could also consider subclassing NSViewAnimation, which I believe Xcode uses in a number of places to achieve its fancy animation effects.

Resources