私はiPhoneアプリケーションを構築しています。アプリを実行すると99レコードの配列があり、メソッドは0から7にcellForRowAtIndexPath
戻り ます。以下のコードは次のとおりですindexPath.row
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [[accountParser accounts]count];//it return 99 records
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
NSLog(@"Index : %d",indexPath.row);//this print index 0 to 7 only
}
return cell;
}