Posts

Showing posts from November, 2015

[IOS] 如何更新 UITableview/UICollectionView 的 cell

[更新 2016/02/10 ] 不知道為什麼,在刪除 cell 時時常會遇到問題 (out of index). 目前找到下面最可靠的解法 /* ref: 自己的 github */ self.TAGS.removeAtIndex((self.collectView.indexPathForCell(cell)?.row)!) self.collectView.deleteItemsAtIndexPaths([self.collectView.indexPathForCell(cell)!]) 由於需要透過使用者 scroll up/down 時添加 UITableView/UICollectionView 中的 cell,昨晚找了些方法,這裡整理一下。 1: (1) 2: - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 3: { 4: // Classic start method 5: } 6: (2) 7: - (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell, forRowAtIndexPath:(NSIndexPath *)indexPath 8: { 9: // check if indexPath.row is last row 10: // Perform operation to load new Cell's. 11: } 12: (3) 13: var refreshControl:UIRefreshControl! 14: override func viewDidLoad() 15: { 16: super.viewDidLoad() 17: self.refreshControl = UIRefreshControl() 18: self.refreshControl.attrib

[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 跟解算法邏輯果然差很大。