UITableViewCell settings (with title/height/logo on the right)

Source: Internet
Author: User

Method:

-(UITableViewCell *) TableView: (uitableview *) TableView Cellforrowatindexpath: (nsindexpath *) indexpath{

//Create cell

UITableViewCell *cell = [[uitableviewcell alloc]initwithstyle: Uitableviewcellstyledefault reuseidentifier:nil];

// set a picture of the cell

nsstring *imagename = [nsstring stringWithFormat:@ "00%ld.png", Indexpath. Row + 1];

Cell. ImageView. image = [UIImage imagenamed:imagename];

set The primary title of the cell

NSString * Text = [nsstring stringWithFormat:@ " product -%ld", Indexpath. Row + 1];

Cell. Textlabel. text = text;

// Set the header of the cell , which is displayed in relation to the style when the cell was created

style = Uitableviewcellstyledefault: Caption Not displayed, picture displayed

style = UITableViewCellStyleValue1: With title and wish title parallel display, picture display

style = UITableViewCellStyleValue2: With caption displayed, picture not displayed

style = Uitableviewcellstylesubtitle: With title and main title up and down, picture display

nsstring *subtitle = [nsstring stringWithFormat:@ " product-%ld very good ", Indexpath. Row + 1];

Cell. Detailtextlabel. text = subtitle;

//Set icon to the right

Cell. accessorytype = Uitableviewcellaccessorydisclosureindicator;

return cell;

}

Set the cell 's height ( inherit delegate method: Not only < Uitableviewdatasource, Uitableviewdelegate, and thecontroller with TableView datasource connection)

-(cgfloat) TableView: (uitableview *) TableView Heightforrowatindexpath: (nsindexpath *) indexpath{

return ;

}

UITableViewCell settings (with title/height/logo on the right)

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.