-1
所以,我剛剛進入整個的tableView的事情,但我遇到了一個奇怪的意見,並有一個問題:中的tableView函數命名約定
爲什麼,在我的UITableViewController
類中重寫這個功能
override func numberOfSections(in tableView: UITableView) -> Int
有一個描述性的名字,但中行的部分數量確定這樣
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int
我覺得前者更符合邏輯和W onder爲什麼它不被用於其他tableView參數。
爲什麼函數tableView的不同版本調用大多數tableView屬性,而不是具有描述性名稱的不同函數?
我確信有一個非常好的理由,如果有人比我更聰明就可以解決這個問題,我會感激的。
看看這個:http://stackoverflow.com/questions/26254875/why-do-all-methods-have-the-same-name-in-delegate –
檢查http://stackoverflow.com/questions/39172041 /覆蓋函數和https://www.hackingwithswift.com/example-code/language/what-does-override-mean –
但是,當與Objective-C的兼容性是原因時,爲什麼'numberOfSections'免於此? – Marmelador