UITableView的数据是从URL取下来后放到数组中的,数据没有问题,加载完向下滑动也没有问题,但是当我从最后一条往回滑动的时候,程序崩溃,相关代码如下:
- (void)viewDidLoad
{
dataArr=[[NSMutableArrayalloc]init];
dataTableView=[[MyTableView alloc]initWithFrame:CGRectMake(0,0,320,416 style:UITableViewStylePlain];
[dataTableViewsetDataSource:self];
[dataTableViewsetDelegate:self];
[self.view addSubview:dataTableView];
[dataTableView release];
NSMutableArray *mydataArr=[[NSMutableArray alloc] init];
self.dataArr = mydataArr;
[mydataArr release];
[self getDataInfo];
[superviewDidLoad];
}
- (void)getDataInfo
{
[ManageRequestDataService getDataInfo: startIndex:0 endIndex:10];
}
- (void)getHomeSportInfoCallBack:(NSNotification*)noti
{
REMOVEOBSERVER(getHomeSportInfoRequestNotificationCallBack);
if([dataArr count] >0) {
[dataArr removeAllObjects];
}
self.dataArr=[[notiobject]retain];
[dataTableViewreloadData];
}
- (NSInteger)tableView:(UITableView*)tableView numberOfRowsInSection:(NSInteger)section
{
return[self.dataArrcount];
}
- (UITableViewCell*)tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath*)indexPath
{
UITableViewCell*cell = [UIImage_NSObjectgetCell:tableViewandIndex:indexPathandFlg:NOandSeparatorFlg:YESandSelectFlg:YES];
if([self.dataArrcount] > indexPath.row) {
UILabel*testLabel = [[UILabelalloc]initWithFrame:CGRectMake(20,5,80,40)];
testLabel.text= [self.dataArr objectAtIndex:indexPath.row];
[cell.contentView addSubview:testLabel];
}
return cell;
}
求解:大概知道是数据同步的问题,但是不知如何解决~
------解决方案--------------------
你应该异常的堆栈贴出来看看。