IPhone Development notes (4) how to change the Row Height of UITableViewCell

Source: Internet
Author: User

When using UITableView, the height of UITableViewCell may change. There are two ways to change the Row Height: the first is to change the height of all rows. The second is to change the Row Height of a Specific Row.

First, change the Row Height of all rows. Is similar to the following results.


The UITableViewDelegate method is used here:

[Plain]
// Set rowHeight
-(CGFloat) tableView :( UITableView *) tableView heightForRowAtIndexPath :( NSIndexPath *) indexPath
{
Return 91.5;
}
Second, if you want to change the Row Height of a row. Similar to the following results.

 

Modify the preceding method as follows:

[Plain]
// Set rowHeight
-(CGFloat) tableView :( UITableView *) tableView heightForRowAtIndexPath :( NSIndexPath *) indexPath
{
If (indexPath. section = 0 & indexPath. row = 0 ){
Return 220;
}
Else
{
Return 40;
}
}


 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.