iOS 開發的一些小技巧(一)
原文 http://www.jianshu.com/p/221507eb8590
1.如何快速的查看一段代碼的執行時間。
#define TICK NSDate *startTime = [NSDate date]define TOCK NSLog(@"Time: %f", -[startTime timeIntervalSinceNow])</pre>
<p> 在想要查看執行時間的代碼的地方進行這么處理 </p>
TICK //do your work here TOCK
2.如何快速查看一個函數的調用次數,且不添加一句代碼。 如下圖
look Hitcount</div>這種方法適合于一個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</div>下面引用了一下網上的具體內容
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</div>看到圖了吧,加這些斷點完全不需要動一下鼠標(恕我吹牛B了),加單獨斷點的時候動了下鼠標,但那是我故意讓你們看到我是有鼠標的。
- 首先All Exception斷點是我們很常用的,這個我是這樣用一個快捷鍵做到的!通過改鍵command +p為加異常斷點的,要說怎么改,翻我以前博客去!
- 然后加symbloic的快捷鍵為commnamd + option + \
- 加一個單獨一行斷點的快捷鍵為command + \
好吧,就說這些吧,最近準備把xVim搞熟練,什么鼠標,觸摸板統統都走開!
</div> </div>本文由用戶 f663x 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!相關資訊