我有两个表视图。
一个很简单,另一个是自定义的。我通过JSON获得价值。我一次发出一个JSON请求,但是当我调用简单表和自定义表的JSON请求时,它会在自定义表上显示数据但突然之后,简单表加载但它隐藏了第一个自定义数据表
有谁知道为什么会这样?
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
if (tableView==self.table) {
return 1;
}
else if(tableView==self.clearificationTable){
return 1;
}
return 0;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
if (tableView==self.table) {
return [reminderArrayList count];
}
else if(tableView==self.clearificationTable) {
return [taskListArray count];
}
return 0;
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
if (tableView==self.table) {
UITableViewCell *cell =[tableView dequeueReusableCellWithIdentifier:@"MyCell"];
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
if (cell == nil){
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"MyCell"];
}
cell.textLabel.text=[reminderArrayList objectAtIndex:indexPath.row];
newCell=cell;
}
else if (tableView==self.clearificationTable) {
static NSString *CellIdentifier=@"Cell";
StaffDahsBoardCustom *cell=[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell==nil) {
[[NSBundle mainBundle]loadNibNamed:@"StaffDahsBoardCustom" owner:self options:nil];
}
cell=custom;
[cell setSelectionStyle:UITableViewCellSelectionStyleNone];
cell.taskListlbl.text=[taskListArray objectAtIndex:indexPath.row];
cell.tasktypelbl.text=[tasktypeArray objectAtIndex:indexPath.row];
cell.completelbl.text=[NSString stringWithFormat:@"%@",[completeArray objectAtIndex:indexPath.row]];
cell.incompletelbl.text=[NSString stringWithFormat:@"%@",[incompleteArray objectAtIndex:indexPath.row]];
cell.nalbl.text=[NSString stringWithFormat:@"%@",[NaArray objectAtIndex:indexPath.row]];
cell.returnlbl.text=[ReturneDateArray objectAtIndex:indexPath.row];
newCell=cell;
}
return newCell;
}
答案 0 :(得分:1)
使用表格的标记值。
firstTable.tag=1;
secondTable.tag=2;