我在主控制器的tableview具有包含3-4個按鈕的自定義單元格重疊視圖..見截圖 當按鈕getpressed它填充一個小的tableview,當我選擇的行新的tableview它不是作品ai的預期看截圖的UITableView與更新錯誤的索引路徑
現在的問題是新的tableview其設定選擇值爲oldtableview相同指數
這裏的代碼:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *MyIdentifier = @"FollowUp";
UITableViewCell *cell ;//= [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] ;
if (tableView == tblScribedBy) {
[cell.textLabel setText:[arrScribedBy objectAtIndex:indexPath.row]];
[cell.textLabel sizeToFit];
}
if (tableView == tblDropDown) {
if ([btnCLicked isEqualToString:@"Cell"]) {
[cell.textLabel setText:[totalRows objectAtIndex:indexPath.row]];
[cell.textLabel sizeToFit];
}
else if ([btnCLicked isEqualToString:@"Drop"]){
[cell.textLabel setText:[arrFUDrop objectAtIndex:indexPath.row]];
}
}
if (tableView == tblView) {
FUCellView * cell = [tableView dequeueReusableCellWithIdentifier:@"myCell"];
if (!cell)
{
[tblView registerNib:[UINib nibWithNibName:@"FUCellView" bundle:nil] forCellReuseIdentifier:@"myCell"];
cell = [tblView dequeueReusableCellWithIdentifier:@"myCell"];
}
[cell.btntfFUCell addTarget:self action:@selector(actionTfCellFU:) forControlEvents:UIControlEventTouchUpInside];
[cell.btntfFUCell setTag:indexPath.row];
[cell.btnDropFU addTarget:self action:@selector(actionDropFU:) forControlEvents:UIControlEventTouchUpInside];
[cell.btnDropFU setTag:indexPath.row];
return cell;
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
FUCellView *cell = (FUCellView *)[tblView cellForRowAtIndexPath:indexPath];
if (tableView == tblScribedBy) {
[self.btnScribedBy setTitle:[NSString stringWithFormat:@" %@",[arrScribedBy objectAtIndex:indexPath.row]] forState:UIControlStateNormal ];
[tblScribedBy setHidden:TRUE];
}
else if (tableView == tblDropDown) {
if ([btnCLicked isEqualToString:@"Cell"]) {
[cell.tfFUCell setText:[totalRows objectAtIndex:indexPath.row]];
}
else if ([btnCLicked isEqualToString:@"Drop"]){
[cell.btnDropFU setTitle:[arrFUDrop objectAtIndex:indexPath.row] forState:UIControlStateNormal];
}
[tblDropDown setHidden:YES];
}
}
//----- Action for Buttons
-(void)actionTfCellFU:(UIButton *)sender
{
btnCLicked = @"Cell";
[tblDropDown setHidden:FALSE];
[tblDropDown reloadData];
}
-(void)actionDropFU:(UIButton *)sender
{
btnCLicked = @"Drop";
[tblDropDown setHidden:FALSE];
[tblDropDown reloadData];
}
顯示呈現所述第二表視圖和視頻在@Wain這樣其附加 – Wain
處理抽頭碼的代碼*細胞= [的tableView dequeueReusableCellWithIdentifier:@「了myCell」 forIndexPath:indexPath]; – iDeepak
雙端隊列細胞兩個表 –