On-Attack UI-------------------plist& custom cell

Source: Internet
Author: User

1.plistNSString *filepath = [[NSBundle mainbundle]pathforresource:@ "name" oftype:@ "plist"]; Nsdictionary *dict = [Nsdictionary Dictionarywithcontentsoffile:filepath];2.tableview's Custom cell1??:cell.m// Custom cell initialization Method-(Instancetype) Initwithstyle: (Uitableviewcellstyle) style Reuseidentifier: (NSString *) reuseidentifier{    if (self = [super Initwithstyle:style reuseidentifier:reuseidentifier]) {         [self p_setupview];   }    return to self;} -(void) p_setupview{    self.myimage = [[Uiimageview alloc]initwithframe:cgrectmake (10, 10, 40, 40)];//     Self.myImage.backgroundColor = [Uicolor browncolor];   // The custom cell adds the control to the cell's Contentview     [Self.contentview addsubview:_myimage];    self.namelable = [[UILabel alloc]initwithframe:cgrectmake (Cgrectgetmaxx (self.myImage.frame) +, Cgrectgetminy ( Self.myImage.frame), Cgrectgetwidth (Self.contentvieW.frame)-Cgrectgetwidth (Self.myImage.frame)-30,cgrectgetheight (self.myImage.frame))];    Self.nameLable.backgroundColor = [Uicolor browncolor];    [Self.contentview addsubview:_namelable];} When bounds changes take place a method-(void) layoutsubviews{    self.nameLable.frame = CGRectMake (Cgrectgetmaxx ( Self.myImage.frame) + ten, Cgrectgetminy (Self.myImage.frame), Cgrectgetwidth (self.contentView.frame)-Cgrectgetwidth (self.myImage.frame)-Cgrectgetheight (Self.myImage.frame));} 2??:controller.m-(void) viewdidload {    [Super viewdidload];   //1 First sign up      [Self.tableview Registerclass:[mycell class] forcellreuseidentifier:@ "cell"];    Self.tableView.separatorStyle = Uitableviewcellseparatorstylenone;} -(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) Indexpath {    //With custom cell    MyCell *cell = [TableView dequeuereusablecellwithidentifier:@ "Cell" forindexpath:indexpath];    cell.myImage.image = [UIImage imagenamed:@ "1.png"];     Cell.nameLable.text = @ "ShK";    cell.nameLable.font = [Uifont systemfontofsize:20] ;    return cell;} 3.cell-model1?? : 2?? : 3?? : 4?? :6??: 

Attack UI-------------------plist& custom cell

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.