小编age*_*t86的帖子

UIAlertController 内存泄漏/问题 - Swift

Instruments 显示了由于简单地打开和关闭警报控制器而导致的内存泄漏。

@IBAction func delBtnAc(sender: AnyObject) {

    let deleteAlert = UIAlertController(title: "Delete Image?", message: "", preferredStyle: .Alert)

    let cancelIt = UIAlertAction(title: "Cancel", style: .Cancel, handler: nil)

    deleteAlert.addAction(cancelIt)
    presentViewController(deleteAlert, animated: true, completion: nil)
}
Run Code Online (Sandbox Code Playgroud)

我已将警报减少为仅用于测试的取消按钮。

编辑:在关闭中删除了 deleteAlert.dismissViewController。修复了保留周期,但仍显示内存泄漏。也许是一个错误。

memory-leaks ios swift uialertcontroller

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

如何在展开segue中添加标识符 - Swift

 @IBAction func unwindOtherVw (seque: UIStoryboardSegue) {
        println("the objectfromOtherView is \(objectFromOtherView!)")
    }
Run Code Online (Sandbox Code Playgroud)

我正在使用prepareForSeque方法从其他ViewController传递一个对象(NSManaged),并在故事板中退出以及目标控制器中的上述代码.一切正常,但我如何在展开segue中添加一个标识符,以便prepareForSegue可以使用ifseque.indentifier == ______

ios swift

0
推荐指数
1
解决办法
1078
查看次数

标签 统计

ios ×2

swift ×2

memory-leaks ×1

uialertcontroller ×1