我想刪除iPhone
應用程序中的tableview單元格,它們也是空的和隱藏的。但這些cells.we採取的空間已經使用這個代碼我想要刪除tableview中的空單元格和隱藏的單元格
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell * cell = [super tableView:tableView cellForRowAtIndexPath:indexPath];
if([cell isKindOfClass:[IASKPSTextFieldSpecifierViewCell class]])
{
UITextField *field = ((IASKPSTextFieldSpecifierViewCell*)cell).textField;
[field setTextColor:LINPHONE_MAIN_COLOR];
}
cell.detailTextLabel.textColor = [UIColor blackColor];
// Background View
UACellBackgroundView *selectedBackgroundView = [[[UACellBackgroundView alloc] initWithFrame:CGRectZero] autorelease];
cell.selectedBackgroundView = selectedBackgroundView;
if (indexPath.section==1)
{
if (indexPath.row== 1)
{
cell.accessoryType=UITableViewCellAccessoryDisclosureIndicator;
return cell;
}
}
if(indexPath.section==0)
{
//NSLog(@"value is--%@",);
if ([cell.textLabel.text isEqualToString:@"Opus 48kHz"])
{
[email protected]"G.711U-law";
}
if ([cell.textLabel.text isEqualToString:@"Silk 24Khz"])
{
[email protected]"G.711A-law";
}
if ([cell.textLabel.text isEqualToString:@"Silk 16Khz"])
{
[email protected]"GSM";
}
if ([cell.textLabel.text isEqualToString:@"AAC-ELD 22kHz"])
{
[email protected]"iLBC30";
}
if (indexPath.row==6)
{
cell.hidden=YES;
// cell=nil;
}
if (indexPath.row==7)
{
cell.hidden=YES;
//cell=nil;
}
if (indexPath.row==8)
{
cell.hidden=YES;
//cell=nil;
}
if (indexPath.row==9)
{
cell.hidden=YES;
//cell=nil;
}
if (indexPath.row==10)
{
cell.hidden=YES;
//cell=nil;
}
if (indexPath.row==11)
{
cell.hidden=YES;
//cell=nil;
}
}
else
{
cell.hidden=YES;
return cell;
}
self.tableView.separatorColor=[UIColor blackColor];
return cell;
}
我承認你。 –
哈哈哈..我也承認你:) – Rajneesh071
你有沒有想過在storyboard或xib中創建靜態tableview? – Abizern