Reveal是一款类似于Chrome的软件,它可以通过2D、3D效果清楚的展示出界面的层级关系,并且可以很方便的更变参数值,在不编辑的情况下实时预览变化情况。Reveal的使用不在累赘,请自行研究(相当简单),下面进入正题怎样安装Reveal。

Reveal安装:
1.在先打开Terminal,在项目根目录下,输入vim ~/.lldbinit 创建一个.lldbinit的文件。
2.在文件中写入一下内容
command alias reveal_load_sim expr (void*)dlopen("/Applications/Reveal.app/Contents/SharedSupport/iOS-Libraries/libReveal.dylib", 0x2);
command alias reveal_load_dev expr (void*)dlopen([(NSString*)[(NSBundle*)[NSBundle mainBundle] pathForResource:@"libReveal" ofType:@"dylib"] cStringUsingEncoding:0x4], 0x2);
command alias reveal_start expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStart" object:nil];
command alias reveal_stop expr (void)[(NSNotificationCenter*)[NSNotificationCenter defaultCenter] postNotificationName:@"IBARevealRequestStop" object:nil];
该步骤其实是为lldb设置了4个别名,这样方便后续操作。这4个别名意义如下:
reveal_load_sim 为模拟器加载reveal调试用的动态链接库;
reveal_load_dev 为真机加载reveal调试用的动态链接库;
reveal_start 启动reveal调试功能;
reveal_stop 停止reveal调试功能。
3. 在APPDelegate类的application:didFinishLaunchingWithOptions方法中增加一个断点并做如下修改,如下图所示

右键断点:点击“Edit Breakpoint”,Action选择Debugger Command,然后在下面输入reveal_load_sim,勾选上Option上的Automatically continue after evaluating actions.
4.运行模拟器,打开Reveal就可以在左上角选择到模拟器。就可以查看修改iOS界面了。

网友评论