我的主要包中包含文件夹,我想在首次启动应用程序时将它们复制/剪切到文档目录,以便从那里访问它们.我见过一些例子,但他们都在Obj-C中,我正在使用Swift 3.我怎么能这样做?
在我的应用程序中我有几个场景,每个都显示不同UIAlertController,所以我创建了一个显示此警报的功能,但我似乎无法在"okAction"内调用self.Function.我收到这个错误:
类型的值
'ViewController'没有成员'doAction'
这是代码:
func showAlertController( titleOfAlert: String, messageOfAlert : String, doAction : () )
{
let refreshAlert = UIAlertController(title: titleOfAlert, message: messageOfAlert, preferredStyle: .Alert)
let okAction = UIAlertAction(title: "Save", style: UIAlertActionStyle.Default) {
UIAlertAction in
self.doAction()
}
let cancelAction = UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Default) {
UIAlertAction in
}
refreshAlert.addAction(okAction)
refreshAlert.addAction(cancelAction)
self.presentViewController(refreshAlert, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)
这是我正在调用的函数之一:
func changeLabel1()
{
label.text = "FOR BUTTON 1"
}
Run Code Online (Sandbox Code Playgroud)
我怎么解决呢?