ios開(kāi)發(fā)的一些小技巧篇一

1.如何快速的查看一段代碼的執(zhí)行時(shí)間。

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

在想要查看執(zhí)行時(shí)間的代碼的地方進(jìn)行這么處理

TICK
//do your work here
TOCK

2.如何快速查看一個(gè)函數(shù)的調(diào)用次數(shù),且不添加一句代碼。 如下圖

look Hitcount
look Hitcount

這種方法適合于一個(gè)if方法,一個(gè)for循環(huán),而且不會(huì)中斷程序,切不需要加一句代碼。但是一定要記得選中下面的automatically continue after evaluting actions;

3.在使用view的縮放的時(shí)候,layer.border.width隨著view的放大,會(huì)出現(xiàn)鋸齒化的問(wèn)題,解決這個(gè)問(wèn)題需要設(shè)置這個(gè)屬性。

self.layer.allowsEdgeAntialiasing = YES;

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

self
self

下面引用了一下網(wǎng)上的具體內(nèi)容

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.如何快速添加一個(gè)全局異常斷點(diǎn),(一步頂三步)。和添加一個(gè)symbloic斷點(diǎn),(一步還是頂三步)添加一個(gè)斷點(diǎn)不使用鼠標(biāo)

add breakPoint
add breakPoint

看到圖了吧,加這些斷點(diǎn)完全不需要?jiǎng)右幌率髽?biāo)(恕我吹牛B了),加單獨(dú)斷點(diǎn)的時(shí)候動(dòng)了下鼠標(biāo),但那是我故意讓你們看到我是有鼠標(biāo)的。

  • 首先All Exception斷點(diǎn)是我們很常用的,這個(gè)我是這樣用一個(gè)快捷鍵做到的!通過(guò)改鍵command +p 為加異常斷點(diǎn)的,要說(shuō)怎么改,翻我以前博客去!
  • 然后加symbloic的快捷鍵為commnamd + option + \
  • 加一個(gè)單獨(dú)一行斷點(diǎn)的快捷鍵為command + \

好吧,就說(shuō)這些吧,最近準(zhǔn)備把xVim搞熟練,什么鼠標(biāo),觸摸板統(tǒng)統(tǒng)都走開(kāi)!

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • **2014真題Directions:Read the following text. Choose the be...
    又是夜半驚坐起閱讀 11,237評(píng)論 0 23
  • 閃電,撕不開(kāi)厚重的黑云 悶雷,堅(jiān)定了摧毀一切的雄心 新聞微信早已告知 臺(tái)風(fēng)暴雨今天光臨 天堂的大門敞開(kāi) 金碧輝煌,...
    老歐_aafd閱讀 371評(píng)論 0 3
  • 作為大名鼎鼎的ios開(kāi)發(fā)包管理工具,估計(jì)無(wú)人不知無(wú)人不曉,你不得不知道的事情是如果要升級(jí)cocoapods你得重新...
    縱橫而樂(lè)閱讀 4,008評(píng)論 1 4
  • 最近在琢磨共享單車為什么這么被資本看好,短短兩年時(shí)間,摩拜單車已經(jīng)融資 9 輪,估值 20 億美金,ofo 也已經(jīng)...
    Xueming閱讀 1,871評(píng)論 3 12
  • |hua 有一個(gè)我很愛(ài)愛(ài)我的家 長(zhǎng)大的我 ,要努力工作存點(diǎn)錢全家一起去度蜜假(去一次首都) 待我二十七八歲,您倆-...
    梨花頌閱讀 350評(píng)論 2 1

友情鏈接更多精彩內(nèi)容