Reputation: 41
i'm the new one develop mac app.When i want to do what i say in title,presentViewController method but with an error said i pass the wrong parameter,but what pass is total the same as what it want. The error message said "Cannot invoke 'presentViewController' with an argument list of type..."
import Cocoa
class MainViewController: NSViewController {
var uploadViewController: UploadViewController!
@IBOutlet weak var HostFileList: NSScrollView!
@IBOutlet weak var AddFileToHost: NSButton!
@IBOutlet weak var DeleteFileFromHost: NSButton!
@IBOutlet weak var Host: NSTextField!
@IBOutlet weak var Port: NSTextField!
@IBOutlet weak var ConnectServer: NSButton!
@IBOutlet weak var UploadFile: NSButton!
override func viewDidLoad() {
super.viewDidLoad()
// Do view setup here.
}
}
extension MainViewController {
@IBAction func UploadFile(sender: AnyObject) {
var uploadViewController = UploadViewController(nibName: "MasterViewController", bundle: nil)
self.presentViewController(uploadViewController, animator: NSTableViewAnimationOptions.SlideRight)
}
}
Upvotes: 1
Views: 210
Reputation: 50089
On OSX, there is no UINavigationController doing the push/pop stuff and the animation for you!
So you have to do it yourself using ViewAnimations and removeFromSuperview and addSubview to switch out the views manually.
there also a lot of ready made ways for you to do iOS-like stuff on the mac: https://www.google.de/search?client=safari&rls=en&q=uinavigationcontroller+osx&ie=UTF-8&oe=UTF-8&gfe_rd=cr&ei=T3OjVfeqPNfIgATS64G4Dw
The most lightweight at first glance looks to be:
https://github.com/bfolder/BFNavigationController
(note: Im not the author and I dont even know him! :D)
Upvotes: 1