%new & 的目的是什么? %班级?
就 MobileSubstrate 调整而言,%new 和 %class 意味着什么?例如:
%class TPBottomLockBar;
抱歉
%new(v@:)
有双重问题!
What do %new and %class mean in terms of MobileSubstrate tweaks? For instance:
%class TPBottomLockBar;
and
%new(v@:)
Sorry for double question!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这些都是逻各斯的构造。
%new
用于在运行时向类添加新方法,其语法为%new(typeencoding)
;您可以在 Apple 的 Objective-C 运行时获取有关 Objective-C 类型编码的信息文档。请注意,这些方法的前两个参数始终是 id 和 SEL,因此类型编码的后两个字符必须是“@:
”。第一个字符是返回类型,其他任何字符都是您的自定义参数集。作为一个例子,这里有一个非常无用的方法:(
这实际上可能不起作用,因为 NSString 是一个类簇,但它同样可以作为一个例子!)
%class
是一个已弃用的指令用于前向声明要在运行时使用的类;它已被替换为%c(ClassName)
,它将内联使用。例如,
These are both Logos constructs.
%new
is for adding new methods to a class at runtime, and its syntax is%new(typeencoding)
; you can get information on Objective-C type encodings in Apple's Objective-C runtime documentation. Note that the first two arguments to these methods are always id and SEL, so the second two characters of your type encoding have to be "@:
". The first character is the return type, and anything else is your set of custom arguments.As an example, here is a pretty un-useful method:
(this will actually probably not work as NSString is a class cluster, but it serves as an example no less!)
%class
is a deprecated directive for forward-declaring a class to be used at runtime; It's been replaced with%c(ClassName)
, which is to be used inline.For example,