gpt4 book ai didi

iphone - 需要做与 NSSelectorFromString() 相反的事情

转载 作者:太空狗 更新时间:2023-10-30 03:57:43 24 4
gpt4 key购买 nike

在 Cocoa 中,您可以编写 @selector(mySelectorNameWithObject:) 来获取编译后的 SEL,或者在运行时,NSSelectorFromString(@"mySelectorNameWithObject:") 返回一个选择。根据Apple documentation :

The only thing that makes the selector method name different from a plain string is that the compiler makes sure that selectors are unique.

但我似乎无法在不崩溃的情况下将 SEL 对象用作字符串。有没有办法获取 SEL 并取回 NSString 对象?基本上我正在寻找与 NSSelectorFromString() 完全相反的东西。

提前致谢。

最佳答案

呃……NSStringFromSelector

关于iphone - 需要做与 NSSelectorFromString() 相反的事情,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2239744/

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