[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's height
ii. pass height calculated on step i to delegate
iii. update your cell so it match the height of each cell
iv. config layout
v. update controller
這太重要了,根本是字字血淚(?!)值得讀N遍.
BTW,這篇文章倒是提醒我了如何作 mobile analytics (azure mobile service, parse, buddy, flurry, google analytics, localytics[作者最後用這個] )

(參考五)關於 navigationItem 的 back button 設定及客製化其實很多眉角要注意,原來 segue life cycle 也是不遑多讓(茶),學習了.



參考
1)raywenderlich 大大的部落格,上面挺多關於 ios 開發的經驗跟範例教學
2)Taylor Franklin
3)SWIFT SWIFT TUTORIALS: CALCULATOR STYLE BUTTONS IN AN AUTO LAYOUT XIB
4)關於 CHTCollectionViewWaterfallLayout 解說
5)navigationItem 的二三事

Comments

Popular posts from this blog

股票評價(Stock Valuation) - 股利折現模型

openwrt feed的使用

R 語言:邏輯回歸 Logistic Regression using R language (二)