iphone - What is the purpose of %new & %class? -
what %new , %class mean in terms of mobilesubstrate tweaks? instance:
%class tpbottomlockbar;
and
%new(v@:)
sorry double question!
these both logos constructs. %new
adding new methods class @ runtime, , syntax %new(typeencoding)
; can information on objective-c type encodings in apple's objective-c runtime documentation. note first 2 arguments these methods id , sel, second 2 characters of type encoding have "@:
". first character return type, , else set of custom arguments.
as example, here pretty un-useful method:
%hook nsmutablestring %new(v@:) - (void)appendawesomethings { [self appendstring:@"awesome."]; } %end
(this not work nsstring class cluster, serves example no less!)
%class
deprecated directive forward-declaring class used @ runtime; it's been replaced %c(classname)
, used inline. example,
[[%c(nsstring) alloc] initwithstring:@"cool."];
Comments
Post a Comment