iOS 開發的一些小技巧篇(1)

發表於2015-03-20

1.如何快速的檢視一段程式碼的執行時間。

在想要檢視執行時間的程式碼的地方進行這麼處理

2.如何快速檢視一個函式的呼叫次數,且不新增一句程式碼。 如下圖

這種方法適合於一個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 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斷點,(一步還是頂三步)新增一個斷點不使用滑鼠

看到圖了吧,加這些斷點完全不需要動一下滑鼠(恕我吹牛B了),加單獨斷點的時候動了下滑鼠,但那是我故意讓你們看到我是有滑鼠的。

  • 首先All Exception斷點是我們很常用的,這個我是這樣用一個快捷鍵做到的!通過改鍵command +p 為加異常斷點的,要說怎麼改,翻我以前部落格去!
  • 然後加symbloic的快捷鍵為commnamd + option + \
  • 加一個單獨一行斷點的快捷鍵為command + \

好吧,就說這些吧,最近準備把xVim搞熟練,什麼滑鼠,觸控板統統都走開!

相關文章