Posts

Showing posts with the label ios

[IOS] 如何在一個 UILabel 上擺不同的 font type. How to put multiple fonts on one single UILabel at a time

今天本來切好的 label 被設計師說要把字串分開,心裡只有三條線。 上網找解法,果然還真的可以。這裡就貼上解法,因為還挺簡單的。( 解法 ) 另外一個問題是 如何上傳一個 customized font 到 app上 。How to include new fonts to IOS App. 寫 app 跟解算法邏輯果然差很大。

[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 ...

[IOS] 學習記錄(一)

原本是負責案子的後台API 制定開發,最近開始因為時間需要支援前端實現 ios app上類似 facebook like box 的頁面. 之前用 swift 寫過一個簡單的 gaming, 但對於 xcode 上寫真正的 app 還是頭一遭. anyway, 下面紀錄一下思路. 如何實現 facebook like box? 首先查了 developer.appple.com 這功能叫做 Table View  ( create a table view ) 目標:     1.  storyboard, scene, view 的定義     2.  table view, inspector (attribute, identity, etc.) 的操作     3.  customise table view cell     4. 如何使用 delegate 及 datasource     5. swift 的 data types (array, string and OOP)     6. display real data on table view 難度在於對於 view 跟 viewController 之間的 binding 的瞭解. xcode 簡化了很多,但是若沒讀一遍 manual 真的是窒礙難行.  (ex.   How to illustrate UITableViewControlller ) 關於 Error "unexpected found nil while unwrapping an Optional value" 的二三事  1. http://www.iphonelife.com/blog/31369/swift-101-working-swifts-new-optional-values  2. http://www.appcoda.com/beginners-guide-optionals-swift/ 如何 a-synchronizingly loading ...