顯示具有 objective-c 標籤的文章。 顯示所有文章
顯示具有 objective-c 標籤的文章。 顯示所有文章

2011年11月2日

XCode: set breakpoint before exception got thrown

有時候 app crash 的點不是在我們自己 code 的範圍,這樣程式停住的點會在 main 裡面
而且還沒有 dump / stack 可以看,這樣很難 debug。

其實可以在 exception 被丟出造成程式結束之前就把它攔下來,這樣就有 stack 可以看。

2011年10月28日

parrentViewController, presentingViewController

又遇到一個 5.0 的改變......

參考官方網頁對 parrentViewController 的說明

Prior to iOS 5.0, if a view did not have a parent view controller and was being presented modally, the view controller that was presenting it would be returned. This is no longer the case. You can get the presenting view controller using the presentingViewController property.

嗯,這又怎樣呢?

2011年10月21日

Crash while calling deleteRowAtIndexPaths:withRowAnimation on UITableView

喔耶又踩一個洞 -_-

deleteRowAtIndexPaths 砍完好像是會 call 一次 row count 做檢查
所以一定要先把 data source 的東西砍了再去 call deleteRowAtIndexPaths
不然就等著接 exception -_-

Calling sequence of presenting a UIViewController on iOS


哈哈哈中鏢了
iOS5 改了 calling sequence
反正都查了就記一下......

當一個  UIViewController 要出現的時候
iOS 4.3  會按順序 call 這些東西
shouldRotate
didLoad
shouldRotate
didRotate
willAppear
didAppear

啊 5.0 改成這樣
shouldRotate
didLoad
shouldRotate
willAppear
shouldRotate
didAppear

我覺得 4.3 看起來比較有道理耶 -.-a

2011年9月22日

Objective-C 遇到 method 撞名會發生什麼事....

這東西果然會這樣.....
A big weakness in Objective-C's weak typing

簡單的說,對一個 id 傳 method 很可能不是傳到你想要的那一個,
而是所有能見的 method 中找一個名字一樣的出來傳進去。
這個「所有能見」當然包含了你自己寫的、你 import 進來的,還有整個 foundation。

self...Why I can change self?

Just because self is merely a hidden variable but not "this".

here is a clear reference: What does it mean when you assign [super init] to self?


標題絕對不是什麼哲學問題wwwwwww

2011年9月19日

Apple open source

原來 apple 有 open source @@
http://www.opensource.apple.com/

上篇提到的 CFArray 在這
http://www.opensource.apple.com/source/CF/CF-368.18/Collections.subproj/

NSArray (CFArray)

要做一些事情,有點在意這東西的 performace
所以就找了一下....發現這篇
傑克這真是太神奇了 -_-
有空我一定要來看一下他的 code .....

另外在這邊看到有人說把要砍的東西先通通放到一個array再一起傳給NSArray叫他砍會比較快
hmm...滿有趣的,可能是 iterator 跑的範圍會越來越小?