Injection简单使用

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/u013163834/article/details/83716710

1.配置

// 1.在Appdelegate 设置路径  
// OC版
NSBundle *resourceBundle = [NSBundle bundleWithPath:@"/Applications/InjectionIII.app/Contents/Resources/iOSInjection.bundle"];
    [resourceBundle load];

2.在需要的UIViewController,UITableViewCell 等任意类实现如下方法:

-(void)injected
{
	NSLog(@" %@ have injected",self);
	// 添加你需要刷新UI的方法
	[self fooxxx];
}

3.打开Injection软件 ,在电脑状态栏点击injection图标,选择open project -->选择你当前运行的工程.
4修改相应代码后 cmd+s即可.

tips:

目前在xcode10 会报Error loading /Applications/InjectionIII.app/Contents/xxxxx …错误
改用xcode9.4即可
5.官网
http://johnholdsworth.com/injection.html

6.具体实现原理可参考:
http://www.cocoachina.com/ios/20180613/23780.html

猜你喜欢

转载自blog.csdn.net/u013163834/article/details/83716710
今日推荐