ios开发的一些小技巧篇一

1.如何快速的查看一段代码的执行时间。

#define TICK   NSDate *startTime = [NSDate date]
#define TOCK   NSLog(@"Time: %f", -[startTime timeIntervalSinceNow])

在想要查看执行时间的代码的地方进行这么处理

TICK
//do your work here
TOCK

2.如何快速查看一个函数的调用次数,且不添加一句代码。 如下图

look Hitcount
look Hitcount

这种方法适合于一个if方法,一个for循环,而且不会中断程序,切不需要加一句代码。但是一定要记得选中下面的automatically continue after evaluting actions;

3.在使用view的缩放的时候,layer.border.width随着view的放大,会出现锯齿化的问题,解决这个问题需要设置这个属性。

self.layer.allowsEdgeAntialiasing = YES;

4.instrument中time profile 中的self, #self,%self各代表什么 ?

self
self

下面引用了一下网上的具体内容

Self is "The number of times the symbol calls itself." according to the Apple Docs on the Time Profiler.

From the way the numbers look though, it seems self is the summed duration of samples that had this symbol at the bottom of its stack trace. That would make:

self: the number of samples where this symbol was at the bottom of the stack trace
% self: the percent of self samples relative to total samples of currently displayed call tree
(eg - #self / total samples).
So this wouldn't tell you how many times a method was called. But it would give you an idea how much time is spent in a method or lower in the call tree.

6.如何快速添加一个全局异常断点,(一步顶三步)。和添加一个symbloic断点,(一步还是顶三步)添加一个断点不使用鼠标

add breakPoint
add breakPoint

看到图了吧,加这些断点完全不需要动一下鼠标(恕我吹牛B了),加单独断点的时候动了下鼠标,但那是我故意让你们看到我是有鼠标的。

  • 首先All Exception断点是我们很常用的,这个我是这样用一个快捷键做到的!通过改键command +p 为加异常断点的,要说怎么改,翻我以前博客去!
  • 然后加symbloic的快捷键为commnamd + option + \
  • 加一个单独一行断点的快捷键为command + \

好吧,就说这些吧,最近准备把xVim搞熟练,什么鼠标,触摸板统统都走开!

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容

  • **2014真题Directions:Read the following text. Choose the be...
    又是夜半惊坐起阅读 9,797评论 0 23
  • 闪电,撕不开厚重的黑云 闷雷,坚定了摧毁一切的雄心 新闻微信早已告知 台风暴雨今天光临 天堂的大门敞开 金碧辉煌,...
    老欧_aafd阅读 330评论 0 3
  • 作为大名鼎鼎的ios开发包管理工具,估计无人不知无人不晓,你不得不知道的事情是如果要升级cocoapods你得重新...
    纵横而乐阅读 3,945评论 1 4
  • 最近在琢磨共享单车为什么这么被资本看好,短短两年时间,摩拜单车已经融资 9 轮,估值 20 亿美金,ofo 也已经...
    Xueming阅读 1,716评论 3 12
  • |hua 有一个我很爱爱我的家 长大的我 ,要努力工作存点钱全家一起去度蜜假(去一次首都) 待我二十七八岁,您俩-...
    梨花颂阅读 310评论 2 1