Я использую UITableView
для отображения различных данных на экране. Я использую UITableViewCell
, созданный кодом в .m файле. Они представляют собой 9 различных типов ячеек с 0 различными идентификаторами и высотами для ячейки. когда одна и та же ячейка с двумя разными высотами в таблице начинает перекрывать друг друга.UiTbleview Cell Overlapping при прокрутке больше времени
Здесь я помещаю код для высоты ячейки метода.
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
if(indexPath.row ==0)
{
return 120.0;
}
else{
//For Action User follow
if(condition)
{
//Checking if the Follow is shared or not
if()
{
//Checking the number of Counts
if()
{
if()
{
if()
{
return 340.0+(arTemp1.count*50.0);
}
else
{
return 157.0+(arTemp1.count*50.0);
}
}
else
{
if()
{
return 340.0+200;
}
else
{
return 157.0+200;
}
}
}
else
{
if()
{
return 340.0f;
}
else{
return 157.0f;
}
}
}
else
{
if(arTemp1.count>0)
{
if(arTemp1.count <4)
{
if()
{
height=height+150;
}
return height+(arTemp1.count*50.0);
}
else
{
if()
{
height= height;
}
return height;
}
}
else
{
if()
{
height= height+40;
}
return height;
}
}
}
else if()
{
if(arTemp1.count>0)
{
if(arTemp1.count <4)
{
return 160.0+(arTemp1.count*50.0);
}
else
{
return 160.0+200;
}
}
else
{
return 150.0f;
}
}
//For Action Add New Reciepe
else if()
{
if(arTemp1.count>0)
{
if(arTemp1.count <4)
{
return 420.0+(arTemp1.count*50.0);
}
else
{
return 420.0+200;
}
}
else
{
return 400.0f;
}
}
else if()
{
if(arTemp1.count>0)
{
if(arTemp1.count <4)
{
return 350.0+(arTemp1.count*50.0);
}
else
{
return 350.0+200;
}
}
else
{
return 350.0f;
}
}
//For Action Added new page
else if()
{
if(arTemp1.count>0)
{
if(arTemp1.count <4)
{
return 350.0+(arTemp1.count*50.0);
}
else
{
return 350.0+200;
}
}
else
{
return 350.0f;
}
}
else if()
{
if(arTemp1.count>0)
{
if(arTemp1.count <4)
{
return 170.0+(arTemp1.count*50.0);
}
else
{
return 150.0+200;
}
}
else
{
return 150.0f;
}
}
//For Action Add Photo
else if()
{
if(arTemp1.count>0)
{
if(arTemp1.count <4)
{
return 350.0+(arTemp1.count*50.0);
}
else
{
return 350.0+200;
}
}
else
{
return 350.0f;
}
}
}
return 0.0f;
}
Cell для кода строки
NSString *CellIdentifier = @"a";
UITableViewCell *a = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (a == nil)
{
//Follow Cell Initializing
a = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
a.selectionStyle = UITableViewCellSelectionStyleNone;
a.tag=a;
//Create Cell Method
[self aCreateCell:a atIndexPath:indexPath];
}
// Set Cell Method
[self aSetCell:a atIndexPath:indexPath];
[a setClipsToBounds:YES];
return a;
показать код для cellforrowatindexpath –