ストーリーボードを使用してカスタムテーブルビューセルを作成するチュートリアルに従っています。UILabelをセルのサブビューとしてドラッグし、そのタグを1に設定します。データソースコードに関して2つの質問があります。
2番目のデキューステートメントの目的は何ですか?カスタムセルを作成するためにストーリーボードを使用しない場合、これはinitメソッドであることを私は知っています。
tableviewとself.tableviewの違いは何ですか?
-(UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath { static NSString *CellIdentifier = @"Cell"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [self.tableView dequeueReusableCellWithIdentifier:CellIdentifier]; } NSDictionary *dToAccess = (self.tableView==tableView)?[self.arForTable objectAtIndex:indexPath.row] : [self.arForSearch objectAtIndex:indexPath.row]; [(UILabel*)[cell viewWithTag:1] setText:[dToAccess valueForKey:@"name"]]; [(UILabel*)[cell viewWithTag:2] setText:[dToAccess valueForKey:@"value"]]; return cell; }