reloadData方面问题,请大神帮忙看看 UItableViewreloadData 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 是不是在其他的地方也有调用的代码?或者tableView有几个实例? 只在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; }} 我也只是 触发单击事件里 调用了 reloadData 而且是在viewDidLoad 中创建的tableView。 你在cellForRowAtIndexPath方法里下断点,能看到两次调用的时机么 断点看一下numberOfRowsInSection 这个代理方法执行几次?如果也执行了两次,可以确定重载了两次数据。还是仔细检查一下。 微信开发,无法回调自己的应用,问题出在注册应用的信息不完整? 表达式连续求值的问题 @@模式窗口的右上角怎样带关闭的叉@@ iphone 显示网页问题 菜鸟求助 oc 又没人总结全面一点的知识点 请问苹果会不会删掉没人用的app 请问发布app的一些问题,在线等,急~ ios 微信分享 如何同时分享多张图片 有做过在cell上点击下载后添加进度条的大神们啊 有关ActionSheet的protocol methods,为什么有一些不起作用? ios如何判断从那个Contoller跳转过来的。
{
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;
}
}