iOS 學(xué)習(xí)總結(jié)

設(shè)置layer.shadow導(dǎo)致子控件染色

設(shè)置該view的背景色為白色


delegate導(dǎo)致內(nèi)存泄漏

weak delegate
protocol前加上@obj


fatal: Could not read from remote repository

1.$ ssh-keygen -t rsa -C "Dwysen" (""內(nèi)為git用戶名)

  1. 一直回車直到出現(xiàn)
    image.png

    3.$ cat /Users/dwyson/.ssh/id_rsa.pub
    (打開圖中的.pub文件),然后復(fù)制ssh-rsa到github Setting中


testView.viewWithTag(0)

使用viewWithTag方法獲取該view上的子view時(shí),tag為0取到的是該view本身,因?yàn)関iew的tag默認(rèn)是0


No such file or directory

上述問題是本人升級(jí)了Mac的系統(tǒng)導(dǎo)致的,當(dāng)你的Mac系統(tǒng)升級(jí)為 high sierra 的時(shí)候,別忘記更新cocoapods。執(zhí)行命令為:
sudo gem update --system sudo gem install cocoapods -n/usr/local/bin

TableView 折疊Section

//  用于記錄section折疊情況的數(shù)組,暫定為兩個(gè)section
var collpse = [true,true]

func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
    
    if collpse[section] == false {
        
        return 10
        
    } else {
        
        return 0
        
    }
}

@objc func tapHeadView(_ sender:UITapGestureRecognizer){
   
    collpse[sender.view!.tag] = !collpse[sender.view!.tag]
    
    if collpse[sender.view!.tag] {
        
        UIView.animate(withDuration: 1, animations: {
            
            self.tableView.height -= 440
            
        })
        
    } else {
       
        self.tableView.height += 440
        
    }

保留小數(shù)點(diǎn)后兩位小數(shù)

 let finalStr = String.init(format: "%.2f", Float(upAndDown!.priceChangeRatio)!)

使某View除了按鈕點(diǎn)擊外不阻擋其后層View的拖拽滾動(dòng)事件

- (UIView *)hitTest:(CGPoint)point withEvent:(UIEvent *)event {
UIView *view = [super hitTest:point withEvent:event];
if ([view isKindOfClass:[UIButton class]]) {
    return view;
}
return nil;
}

self.navigationItem.titleView ≠ self.navigationController.navigationItem.titleView

設(shè)置了self.navigationController.navigationItem.titleView,界面上出不來
改為self.navigationItem.titleView后正確

OCR

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容