小编Ser*_*geH的帖子

Swift 3 - 将包含内容的文件夹从主包复制到文档目录

我的主要包中包含文件夹,我想在首次启动应用程序时将它们复制/剪切到文档目录,以便从那里访问它们.我见过一些例子,但他们都在Obj-C中,我正在使用Swift 3.我怎么能这样做?

ios mainbundle documentsdirectory swift3

9
推荐指数
1
解决办法
2544
查看次数

Swift - 类型的值ViewController没有成员*functionName*

在我的应用程序中我有几个场景,每个都显示不同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)

我怎么解决呢?

function ios swift

8
推荐指数
1
解决办法
4万
查看次数

标签 统计

ios ×2

documentsdirectory ×1

function ×1

mainbundle ×1

swift ×1

swift3 ×1