Ravi
Ravi

Reputation: 1759

how to reduce the width of table view controller

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 *)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;

}

Upvotes: 0

Views: 306

Answers (2)

Simon Lee
Simon Lee

Reputation: 22334

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

Upvotes: 1

rckoenes
rckoenes

Reputation: 69469

An UITableViewCell will always take the full width of the UITableView that is displaying the cell.

Upvotes: 1

Related Questions