如何阅读此方法并了解它。
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
&安培;
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
答案 0 :(得分:0)
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section;
- Means that the method is a instance method VS `+(NSInteger)something` which is a class method. The + and - mean different things like explained.
`NSInteger` - the return value which is a Integer. NS is a apple class prefix.
tableView is the method name. If you type `tableView` in your `ViewController` which has a `UITableview` you will get all delegate methods.
(UITableView *)tableView is the first argument of the method. tableView is a pointer which helps you access your UITableView object in memory.
numberOfRowsInSection:(NSInteger)section is the second argument.
; Means that it is a method declaration vs a method definition.
答案 1 :(得分:0)
每个func都有一个返回类型,这意味着该函数实际返回的内容,因此您必须使用return
关键字来完成此操作。
numberOfRowsInSection
返回Integer
cellForRowAtIndexPath
返回UItableViewCell