-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