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

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -