解决方案 »

  1.   

    是不是在其他的地方也有调用的代码?或者tableView有几个实例?
      

  2.   

    只在viewDidLoad中创建了一个  tableview = [[UITableView alloc]initWithFrame:CGRectMake(0, 110,[UIScreen mainScreen].bounds.size.width,[UIScreen mainScreen].bounds.size.height - 110) style:UITableViewStylePlain];- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
    {
            static NSString *TableSampleIdentifier = @"TableSampleIdentifier";
            UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:TableSampleIdentifier];
            if (cell == nil)
            {
                cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:TableSampleIdentifier];
                
                //在添加cell时添加边线框
                UIView *backView = [[UIView alloc] initWithFrame:cell.frame];
                backView.layer.masksToBounds = YES;
                backView.layer.cornerRadius = 1.0;
                backView.layer.borderWidth = 1.0;
                backView.layer.borderColor = [[UIColor lightGrayColor] CGColor];
                [cell addSubview:backView];        }
            if (_chapterList.count == 2) {
                NSLog(@"sdasdasdsdasd111111111111");
            }
            NSUInteger row = [indexPath row];
            cell.textLabel.text = [[_chapterList objectAtIndex:row]objectForKey:@"type_name"];
            return cell;
        }
    =================
    - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
    {
                 NSUInteger row = [indexPath row];             //这部分解析xml 的
                self startParseQuestion:[[_chapterList objectAtIndex:row] objectForKey:@"id"] ];
                
                [_questionList removeAllObjects];
                // 将解析到的数据放入_questionList中
                [_questionList addObjectsFromArray:[myPlayer questionDataArray]];
                if (_questionList.count == 0)
                {             
                    UIAlertView *alter = [[UIAlertView alloc] initWithTitle:@"提示" message:@"该部分内容正加紧录制中,敬请期待!" delegate:self cancelButtonTitle:@"OK" otherButtonTitles:nil];
                    [alter show];
                    
                }
                else
                {
                    [self.tableview reloadData];
               }
    }
    ============
    -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
    {
        if (isQuestion != NO)
        {
            NSLog(@"_questionList.count::::%d",_questionList.count);
            return _questionList.count;
        }
        else
        {
            NSLog(@"_chapterList.count::::::%d",_chapterList.count);
            return _chapterList.count;
        }
    }
      

  3.   

    我也只是 触发单击事件里 调用了 reloadData  而且是在viewDidLoad 中创建的tableView。
      

  4.   

    你在cellForRowAtIndexPath方法里下断点,能看到两次调用的时机么
      

  5.   

    断点看一下numberOfRowsInSection 这个代理方法执行几次?如果也执行了两次,可以确定重载了两次数据。还是仔细检查一下。