Reputation: 529
I'm fairly new to Xcode and Swift. I dragged a horizontal NSSlider from Xcode's Object Library onto the View Controller of my Storyboard. Now I realize that I probably would have been better using a vertical slider. Is it possible to change my current slider into an actual vertical slider easily, keeping the max and min values, connections to my ViewController.swift file, etc. without having to reconfigure them?
I don't want to programmatically change it; I want it to be a static vertical slider.
I realize that in the documentation there is an isVertical
variable to make it vertical, but that's not what I'm looking for. I want to it be vertical on my Storyboard, and be able to move it around – I don't want it to become vertical when viewDidLoad(). Actually I tried that out of curiosity and it didn't do a great job changing my horizontal slider into a vertical one.
Upvotes: 1
Views: 1025
Reputation: 3231
Interface Builder derives the horizontal/verticalness of the slider based on whether it's wider or taller. So you can change this by editing the frame size of the slider to have a larger height than width.
One way do this is to view the storyboard document source (right click the file, Open As ▸ Source Code) and flip the width and height of the slider, e.g.:
When you open the document back as an Interface Builder Document, the slider will appear and act as a horizontal slider.
Upvotes: 2
Reputation: 3802
You can just drag a Vertical Slider
in storyboard and remove the Horizontal Slider
Upvotes: 0