[原]逆向iOS SDK -- +[UIImage imageNamed:] 的实现
匯編代碼:
| ; Dump of assembler code for function +[UIImage imageNamed:] ; R0 = UIImage, R1 = "imageNamed:", R2 = imageFileName push? {r4, r5, r7, lr} ; 從右向左,依次將這些寄存器壓棧 movw? r1, #62936 ;R1(低16位) = selRef_mainBundle 地址偏移量的低 16 位的? add???r7, sp, #8 ; R7 = 棧上的值 movt? r1, #3292? ; R1(高16高) = selRef_mainBundle 地址偏移量的高 16 位 movw? r0, #44426 ; R0(低16位) = classRef_NSBundle 偏移量的低 16 位 movt? r0, #3293? ; R0(高16位) = classRef_NSBundle 偏移量的高 16 位 add???r1, pc ; R1 = selRef_mainBundle add???r0, pc ; R0 = classRef_NSBundle mov???r4, r2 ; R4 = R2 = imageFileName ldr???r1, [r1, #0] ; R1 = "mainBundle" ldr???r0, [r0, #0] ; R0 = NSBundle blx???0x31f862a4 <dyld_stub_objc_msgSend> ; [NSBundle mainBundle] mov???r5, r0 ; R5 = R0 = mainBundle bl????0x31e0abb4 <_UIScreenForce1xScale> ; _UIScreenForce1xScale(), ;判斷是否是高清屏:高清屏返回 YES,低分屏返回 NO mov???r1, r5 ; R1 = R5 = mainBundle mov???r2, r0 ; R2 = R0 = isRetina mov???r0, r4 ; R0 = R4 = imageFileName ldmia.w?sp!, {r4, r5, r7, lr} ; b.w?? 0x31bc2898 <_UIImageAtPath> ; ;_UIImageAtPath(NSString *imageFileName, NSBundle *mainBundle, BOOL isRetina) nop ; End of assembler dump. |
?
偽代碼:
| + (UIImage *)imageNamed:(NSString *)imageFileName { ? ? ??NSBundle *mainBundle = [NSBundlemainBundle]; ?????BOOL isRetina = _UIScreenForce1xScale(); ?????return_UIImageAtPath(imageFileName, mainBundle, isRetina); } |
?
?
轉(zhuǎn)載于:https://www.cnblogs.com/Proteas/p/3172894.html
總結(jié)
以上是生活随笔為你收集整理的[原]逆向iOS SDK -- +[UIImage imageNamed:] 的实现的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: matlab编译器和程序发布
- 下一篇: 内地企业香港上市条件 满足一项财务准则即