http://www.waterworld.com.hk/zh-hant/blog/pull-down-refresh-table-view
Programming/iOS
[iPhone dev] 今天看到一個精巧的設計 / tableview / iPhone design pattern
首先, 可以這樣定義 , 定義出有 3 個 section , 在那個 enum Sections array 中, 第一個 item 就讓它的 value = 0 , 那麼最後一個item : NUM_SECTIONS 的 value自然就是這個 array 的 item 數, 就這樣精簡漂亮!!讚嘆! code 寫這樣就非常清楚易懂, 也好 maintain.
再依此定義出 每個 section 的 rows …..
—-
在 numberOfRowsInSection 中, 直接來個 switch(section) 用 case name 的方式 ,直接 return 該 section 有多少 rows 數值回去…, 若無法 mapping 到的 section 就是用 default return 0;
—
在 cellForRowAtIndexPath 中 , 要 show 出該 section 的 該 row 內容, 也是用 switch case mapping 的方式 , 把正確的內容回傳…
—
點選 row 時的處理, 也是同樣的作法…
—
[書上沒教的] iPhone / xcode 出現這種 error : Check dependencies …error: There is no SDK with the name or path ‘iphoneosx.x’
想抓別人的 iphone project 來試玩看看, 在 build 時會有這種 message 的解決方法
Check dependencies
error: There is no SDK with the name or path ‘iphoneos2.2’
重選 “Base SDK for All Configurations” , 如圖:
推薦 iPhone & iPad App 開發參考書 / dev books
iPhone.and.iPad.Apps.for.Absolute.Beginners(Apress.2010-05) | |