osx - Xcode Cocoa text field to equal file path -
how can have top text field equal path selected user? i'm new xcode appreciated.
import cocoa class viewcontroller: nsviewcontroller { @ibaction func browsedmf(sender: nsopenpanel) { var openpanel = nsopenpanel() openpanel.allowsmultipleselection = false openpanel.canchoosedirectories = true openpanel.cancreatedirectories = false openpanel.canchoosefiles = false openpanel.beginwithcompletionhandler { (result) -> void in if result == nsfilehandlingpanelokbutton { } } } @iboutlet weak var textfielddmf: nstextfield!
here updated code:
import cocoa class viewcontroller: nsviewcontroller { @ibaction func browsedmf(sender: nsopenpanel) { var openpanel = nsopenpanel() openpanel.allowsmultipleselection = false openpanel.canchoosedirectories = true openpanel.cancreatedirectories = false openpanel.canchoosefiles = false openpanel.beginwithcompletionhandler { (result) -> void in if result == nsfilehandlingpanelokbutton { nsurl *pathurl = [[openpanel urls] objectatindex:0]; [textfielddmf setstringvalue:[pathurl absolutestring]]; } } } @iboutlet weak var textfielddmf: nstextfield!
Comments
Post a Comment