我正在开发一个iPhone应用程序,并且在检查分组tableview的部分时遇到了一些麻烦。当第一部分不再可见时,因为我向下滚动了tableview并且tableview弹回了,第二部分从第一部分获取设置?我使用indexPath.section值来检查它是哪一部分。我该如何解决这个问题?对不起,如果我的英语不正确!UITableView部分当上一部分不在屏幕上iPhone
抱歉缺少代码! 这里是一块的cellForRowAtIndexPath代码:
- (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];
}
if(indexPath.section == 0){
pinSwitch.hidden = YES;
cell.imageView.image = [UIImage imageNamed:@"test_item.png"];
if([headarray count] != 0){
if(indexPath.row > [headarray count] - 1){
cell.imageView.alpha = 0;
cell.textLabel.text = [NSString stringWithFormat:@"Add new",indexPath.row + 1];
}
else{
cell.imageView.alpha = 1;
NSArray *infoarray = [headarray objectAtIndex:indexPath.row];
cell.textLabel.text = [infoarray objectAtIndex:0];
}
}
}
else if(indexPath.section == 1){
if(indexPath.row == 0){
//some more cell data
}
我认为这应该是足以显示我的问题!对细胞的产生
你的问题是bit diffuse ..提供一些代码并解释你想要做什么样的检查? – Stas 2012-02-09 17:18:01
具体来说,如果您可以向我们展示您的'cellForRowAtIndexPath:'我们应该能够弄清楚。 – yuji 2012-02-09 17:47:52