Created
July 22, 2018 05:37
-
-
Save sasikanth513/5c6013973efcc1b621ed49602f76683f to your computer and use it in GitHub Desktop.
Mac os swift app to add horizontal scroll to the text view
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController: NSViewController { | |
@IBOutlet weak var scrollView: NSScrollView! | |
@IBOutlet var textView: NSTextView! | |
override func viewDidLoad() { | |
super.viewDidLoad() | |
// Do any additional setup after loading the view. | |
scrollView.hasHorizontalScroller = true | |
textView.maxSize = NSMakeSize(CGFloat(Float.greatestFiniteMagnitude), CGFloat(Float.greatestFiniteMagnitude)) | |
textView.isHorizontallyResizable = true | |
textView.textContainer?.widthTracksTextView = false | |
textView.textContainer?.containerSize = NSMakeSize(CGFloat(Float.greatestFiniteMagnitude), CGFloat(Float.greatestFiniteMagnitude)) | |
} | |
override var representedObject: Any? { | |
didSet { | |
// Update the view, if already loaded. | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment