1
在練習中我正在做的顯示/隱藏值在UITableView像MXPlayer在android中。 當我添加的值,它應該顯示新在標籤我已經爲自定義單元格。一旦我讀取值,它將顯示在下一個視圖,然後回到列表視圖顯示正確,因爲我例外,但如果我點擊另一個值,它會改變以前的值。在iOS7中顯示/隱藏UITableView中的新值?
這個代碼,我試了far..help我
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *Identifier = @"ceelll";
customCell *cell =(customCell *) [tableView dequeueReusableCellWithIdentifier:Identifier];
if (cell==nil) {
cell=[[[NSBundle mainBundle]loadNibNamed:@"customCell" owner:self options:nil]objectAtIndex:0];
}
cell.dataLbl.text=self.listData[indexPath.row];
if([self.checkedData isEqual:indexPath])
{
[email protected]"VIEW";
cell.NewHideLbl.textColor=[UIColor greenColor];
}
else
{
[email protected]"NEW";
cell.NewHideLbl.textColor=[UIColor redColor];
}
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
if(self.checkedData)
{
customCell* cell =(customCell*) [tableView cellForRowAtIndexPath:self.checkedData];
[email protected]"NEW";
cell.NewHideLbl.textColor=[UIColor redColor];
}
if([self.checkedData isEqual:indexPath])
{
self.checkedData = nil;
}
else
{
customCell* cell =(customCell*) [tableView
cellForRowAtIndexPath:indexPath];
[email protected]"VIEW";
cell.NewHideLbl.textColor=[UIColor greenColor];
self.checkedData = indexPath;
}
self.detailObj.tempStr=self.listData[indexPath.row];
[self.navigationController pushViewController:self.detailObj animated:YES];
}
這是學習的目的only..Help我在此先感謝..