原创 改變headerView/footerView的背景顏色
- (void)tableView:(UITableView *)tableView willDisplayHeaderView:(nonnull UIView *)view forSection:(NSInteger)section
原创 UIButton點擊事件傳值,除了用tag,還能這麼傳。
step1: 導入頭文件, #import <objc/runtime.h> static NSString *keyOfTarget; step2: 創建button 添加方法runtime方法 UIButton *btn =
原创 iOS 常用幾種數據持久化
目錄 一、沙盒 二、數據持久化方式 * 常用幾種數據持久化方式對比 * 屬性列表plist * 偏好設置Preference * 對象歸檔(以下只例舉了自定義類的歸檔方法) * FMDB(基本方法示例) * FMDB(單例用法示例) 一
原创 一句代碼清空所有子視圖
[view.subviews makeObjectsPerformSelector:@selector(removeFromSuperview)];
原创 解決其它手勢導致屏幕邊緣側滑返回上一頁失效的方法
* 屏幕邊緣側滑返回上一頁是因爲響應了self.navigationController的interactivePopGestureRecognizer手勢; * 返回失效的原因主要是UIPanGestureRecognizer與inte
原创 如何在storyboard設置圓角(cornerRadius)、邊框(borderWidth)等操作。
目錄 方法1:Runtime Attributes 方法2:使用@IBInspectable(下面以UIButton爲例介紹使用方法) Step1:創建一個UIButton分類(Category)UIButton+Layer Step2:
原创 iOS靜態cell(static cell)和動態cell(dynamic cell)混合使用注意事項
使用方法網上很多不贅訴,只說注意事項,不做會崩潰 1、 storyboard中動態Cell所在的section中必須預留一個Cell,可以是任意一個Cell; 2、 - (NSInteger)tableView:(UITableView
原创 用storyboard、代碼解決狀態欄留白問題(即使tableView的y從0開始仍然無法從屏幕頂端開始)
想要達到視圖從屏幕上邊緣就開始顯示怎麼做? 解決方案: 1、代碼 if (@available(iOS 11.0, *)) { self.tableView.contentInsetAdjustmentBehavior = U
原创 知識點(陸續補充)
目錄 1、stringByAppendingPathComponent和stringByAppendingString的區別 2、解決其它手勢導致側滑返回手勢(interactivePopGestureRecognizer)失效的方法 3