hii every one
how dod i reduce the width of the table view cell?
i am using following code to increase the height of the row ,, in the same way how can i alter width of the cell
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath开发者_C百科 *)indexPath
{
switch(indexPath.section)
{
case 0:
{
switch(indexPath.row)
{
case 0:
{
return 100;
}
break;
case 1:
{
return 40;
}
break;
case 2:
{
return 40;
}
break;
case 3:
{
return 40;
}
break;
default:
{
return 15;
}
}
}
break;
}
As mentioned a cell will always have the same width, if however you wish to indent the content to show a master-detail relationship then use...
- (NSInteger)tableView:(UITableView *)tableView indentationLevelForRowAtIndexPath:(NSIndexPath *)indexPath
An UITableViewCell will always take the full width of the UITableView that is displaying the cell.
精彩评论