ios开发的一些小技巧篇一

作者: kissGod | 来源:发表于2015-03-13 17:14 被阅读12649次

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

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

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

    TICK
    //do your work here
    TOCK
    

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

    look Hitcountlook 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各代表什么 ?

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

    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 breakPointadd breakPoint

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

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

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

    相关文章

      网友评论

      • 我是卖报滴小行家:你的代码是怎么添加进去的啊
      • 我叫阿水:你那个判断函数调用次数是在哪里点出来的==不带这么分享的
      • aceebf116ba8:好奇的问一下,你上面第一个图是怎么截出来的?主要是背景的纯黑色,PS么?还是有什么便捷的工具? :blush:
      • 56c3e5e9c9b2:@kissGod 哦,哦,知道了,😁
      • kissGod:@柴米油盐 你得分享东西,要不只是单纯的一味问我问题,那咱们加微信就相当于我当了个老师了。。。你简书可一篇文章都没写呢~
      • 56c3e5e9c9b2:@kissGod 哦,好好用啊这个软件,加个微信吧,都是程序员,好好向你请教
      • kissGod:@柴米油盐 就是 mou,嘿嘿我刚好在线!
      • 56c3e5e9c9b2:我想知道你这么笔记软件叫什么名字?谢谢
      • kenny肉桂:@夏都 非常感谢!
      • 夏都:@quentingui xvim的github上已经有支持6.2的提交记录了应该是直接可以用了。不行的话请:
        1、~Library/Application Support/Developer/Shared/Xcode/Plugins
        2、 找到xvim的plugin然后打开包内容
        3、找到包里头的info.plist
        4、 在DVTPlugInCompatibilityUUIDs里头加一行A16FF353-8441-459E-A50C-B071F53F51B7
      • kenny肉桂:@夏都 求解,就是因为这个插件所以没有升级的... 还有很多一直用的插件升级了之后发现不能用,于是又降了回来
      • 夏都:xvim支持6.2不过要改下插件的plist文件
      • kissGod:@quentingui 天啊噜,我用的是xcode6.1,还是先不升级,等它支持了在升级~
      • kenny肉桂:xvim不支持xcode6.2了……

      本文标题:ios开发的一些小技巧篇一

      本文链接:https://www.haomeiwen.com/subject/kqmbxttx.html