gpt4 book ai didi

xcode - 如何在 Swift 中表示 NULL 选择器

转载 作者:可可西里 更新时间:2023-11-01 02:26:25 26 4
gpt4 key购买 nike

当我尝试使用函数 .removeTarget(nil, action: NULL, forControlEvents: UIControlEvents.AllEvents) 删除所有关联的操作时

我意识到你不能使用 NULL。那这里用什么?

非常感谢!

最佳答案

NULL 选择器可以用 nil 构造:

let sel:Selector = nil

Selector()

所以你可以:

.removeTarget(nil, action: nil, forControlEvents: .AllEvents)
// OR
.removeTarget(nil, action: Selector(), forControlEvents: .AllEvents)

关于xcode - 如何在 Swift 中表示 NULL 选择器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27648708/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com