喜的朋友這是一個奇怪的問題,我面對的,我用的多UItableCustomCells
在一個分組TableView中與科的。能不能從的tableView
我可以只選擇第一部分中的行,然後當我點擊其他部分的排它的選擇方法不工作,我不明白的地方是錯誤的,我cellForRowAtIndexPath
代碼如下: -
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSString *CellIdentifier =[NSString stringWithFormat:@"%d",indexPath.row];
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
//if (cell == nil) {
if(indexPath.section==0)
{
if(indexPath.row==0)
{
[[NSBundle mainBundle]loadNibNamed:@"CustomCell1" owner:self options:nil];
cell = self.Cell1;
self.Cell1 = nil;
txtincidentName = (UITextField*)[cell.contentView viewWithTag:1];
}
else if(indexPath.row==1)
{
[[NSBundle mainBundle]loadNibNamed:@"CustomCell2" owner:self options:nil];
cell = self.Cell2;
self.Cell2 = nil;
lblDatefirst = (UILabel*)[cell.contentView viewWithTag:2];
btnCalfirst = (UIButton*)[cell.contentView viewWithTag:3];
lblTimeFirst = (UILabel*)[cell.contentView viewWithTag:4];
}
else if(indexPath.row==2)
{
[[NSBundle mainBundle]loadNibNamed:@"CustomCell2" owner:self options:nil];
cell = self.Cell2;
self.Cell2 = nil;
lblDatefirst = (UILabel*)[cell.contentView viewWithTag:2];
btnCalfirst = (UIButton*)[cell.contentView viewWithTag:3];
lblTimeFirst = (UILabel*)[cell.contentView viewWithTag:4];
lblInciTime =(UILabel*)[cell.contentView viewWithTag:9];
[email protected]"Date/Time";
}
}
else if(indexPath.section==1)
{
if(indexPath.row==0)
{
[[NSBundle mainBundle]loadNibNamed:@"CustomCell3" owner:self options:nil];
cell = self.Cell3;
self.Cell3 = nil;
btndropDown1 = (UIButton*)[cell.contentView viewWithTag:5];
btndropDown2 = (UIButton*)[cell.contentView viewWithTag:6];
btndropDown3 = (UIButton*)[cell.contentView viewWithTag:7];
}
else if(indexPath.row==1)
{
[[NSBundle mainBundle]loadNibNamed:@"CustomCell4" owner:self options:nil];
cell = self.Cell4;
self.Cell4 = nil;
txtViewofdetails = (UITextView*)[cell.contentView viewWithTag:7];
}
}
return cell;
}
模擬圖像
請幫助和指導謝謝。
的流量,你可以從後'DidselectRowAtindexPath'一些代碼? –
使斷點didSelectRow..are你能夠訪問此/ ..? – Rajneesh071
不藍線出現在選擇 –