I am making an OSX Cocoa application in Xcode. I want to have a panel on the left side of the app that displays a clickable list of the files in the given folder and when the user clicks on one that file should open in a NSTextView on the right side of the app. I have figured out how to open, save and write to the files in the given folder, but I am at a loss for how to make a selectable view with file names.
I was thinking about using an OnClicked method for file opening.
Also, I do not want to use the OpenFile drop down panel, I want the files to be shown on the screen.
You should use NSOutlineView
to display the list of files. You can populate it by iterating through the filesystem with NSFileManager
.
Then, when the outline view's selection changes, you can read the contents of the file and set the NSTextView
's string
property.