我知道很多人问这个,但所有答案都是特定的应用程序,所以我不明白如何为我的应用程序工作.
tableData = [NSArray arrayWithObjects:@"Chocolate Brownie", @"Mushroom Risotto", nil];
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection: (NSInteger)section
{
return [tableData count];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *simpleTableIdentifier = @"SimpleTableItem";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:simpleTableIdentifier];
}
cell.textLabel.text = [tableData objectAtIndex:indexPath.row];
return cell;`
}
Run Code Online (Sandbox Code Playgroud) 我在网上看过,但没有一个解决方案有所作为.
for (int i = 0; i < posts.count; i++) {
quotesArray addObject: [((NSDictionary *)(posts[i])) objectForKey:@"quote"];
personArray addObject: [((NSDictionary *)(posts[i])) objectForKey:@"person"];
}
Run Code Online (Sandbox Code Playgroud)
问题出在第二和第三行.问题是什么?