Posts

Showing posts from October, 2015

[IOS] 學習記錄(二)

這兩週開發 iOS APP 可以說是一團糟,主要是不熟悉 IB (Interface Builder) 介面,constraint 設定以及 storyboard 跟 segue, xib 三者之間的曖昧情仇(咦?)搞的我每天都在把 view 砍掉重練(馬的),就當作是練功了.這裡記錄一些經驗跟教訓. (參考一)是關於 performance issues, memory leak, reference cycles, etc 的教學文件 1. how to determine hot-spots using time profiler instrument 2. how to detect and fix memory management issues such as strong memory reference cycles using allocations 3. TL;RL :P (參考二)也是關於 memory management 雖說 swift 也有類似 java, python 提供 garbage recycling 跟 ARC (automatic reference counting) 的機制,但是仍是有機會發生 memory issues. 1. retain cycles, 這應該是在說 strong/weak reference, 不知道 swift 能否指定. 2. unnecessary caching, 檢查代碼中的 cache 使用時機. (作者使用 library 去trace, 但不知道是哪個) note:  swift 有些 libraries的底層仍有些是用 objective-c, 所以仍需要小心 (參考三)主要是xib 跟 storyboard 之間元件跟設計上如何互動的教學,雖然我最後決定放棄了 xib ,主因是他在 segue 跟 元件的 event 上增加太多程式邏輯,本來在 storyboard 上可以輕鬆解決的事情卻搞得很累. (參考四)這篇我也忘了當初找他的目的,大概是遇到要動態更新 CHTCollectionViewWaterfallLayout 的 layout 吧,但這文章提到點我覺得很值得一提,就是他 coding 的流程: i. calculate cell