Simple iOS Mini-interface

Source: Internet
Author: User

I wrote a little thing in the afternoon. Small interface

There is a need for direct use, concise, very good-looking, self-feeling;


The writing interface is actually top-down in view plus space, take a look at the location of the line

-(ID) initWithFrame: (cgrect) frame{self = [super Initwithframe:frame];                if (self) {cgrect screensize = [[UIScreen mainscreen]bounds];        No cargo information picture Uiimageview *image = [[Uiimageview alloc]initwithframe:cgrectmake (0, 0, 160, 100)];        Image.center = Cgpointmake (screensize.size.width/2,screensize.size.height/2-15-55);        Image.image = [UIImage imagenamed:@ "nocargo.jpg"];        Image.backgroundcolor = [Uicolor Orangecolor];        [Self addsubview:image];        You don't have a shipping address. label UILabel *nolabel = [[UILabel alloc]initwithframe:cgrectmake (0, 0, 160, 30)];        Nolabel.center =cgpointmake (SCREENSIZE.SIZE.WIDTH/2,SCREENSIZE.SIZE.HEIGHT/2);        Nolabel.text = @ "You have not harvested the address";        Nolabel.textalignment = Nstextalignmentcenter;        Nolabel.font = [Uifont fontwithname:@ "Helvetica" size:19];                [Self Addsubview:nolabel];      Please add a new address label UILabel *addlabel = [[UILabel alloc]initwithframe:cgrectmake (0, 0, 150, 30)];  Addlabel.center =cgpointmake (screensize.size.width/2,screensize.size.height/2+30);        Addlabel.text = @ "Please add new address";        Addlabel.textalignment = Nstextalignmentcenter;        Addlabel.font = [Uifont fontwithname:@ "Helvetica" size:15];                [Self Addsubview:addlabel];        Add new Address button settings addaddressbtn = [[UIButton alloc]initwithframe:cgrectmake (0, 0, 150, 30)];        Addaddressbtn.center = Cgpointmake (screensize.size.width/2,screensize.size.height-40);        [Addaddressbtn settitle:@ "Add new Address" forstate:uicontrolstatenormal];        [Addaddressbtn addtarget:self Action: @selector (Addaddressbtnclick) Forcontrolevents:uicontroleventtouchdown];        AddAddressBtn.layer.borderWidth = 1;        AddAddressBtn.layer.cornerRadius = 5; AddAddressBtn.layer.borderColor = [Uicolor Redcolor].        Cgcolor;        AddAddressBtn.titleLabel.font = [Uifont fontwithname:@ "Helvetica" size:18];        AddAddressBtn.titleLabel.textColor = [Uicolor Redcolor]; [Self Addsubview:adDADDRESSBTN];    Self.backgroundcolor = [Uicolor colorwithred:238/255.0 green:238/255.0 blue:238/255.0 alpha:1];; } return self;}

The above is all the content of the first page;

Let's take a look at the second picture.


Xib Adding controls to this effect three are all labels; set a font or something. The last plus a small picture arrow

Note that in the address we used the Rich text label will "default" set to red, see the second picture;


nsmutableattributedstring *str = [[Nsmutableattributedstring alloc] initwithstring:@ "Using nsattributed String"]; [Str addattribute:nsforegroundcolorattributename value:[uicolor Bluecolor] Range:nsmakerange (0,5)]; [Str addattribute:nsforegroundcolorattributename value:[uicolor Redcolor] Range:nsmakerange (6,12)]; [Str addattribute:nsforegroundcolorattributename value:[uicolor Greencolor] Range:nsmakerange (19,6)]; [Str addattribute:nsfontattributename value:[uifont fontwithname:@ "ARIAL-BOLDITALICMT" size:30.0] Range:NSMakeRange (0, 5)]; [Str addattribute:nsfontattributename value:[uifont fontwithname:@ "Helveticaneue-bold" size:30.0] Range:NSMakeRange (6, 12)]; [Str addattribute:nsfontattributename value:[uifont fontwithname:@ "Courier-boldoblique" size:30.0] Range: Nsmakerange (6)];attrlabel.attributedtext = str;

This section of code from http://www.cnblogs.com/taintain1984/p/3550525.html;

The following is the code to set the TableCell;

-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) indexpath{    static NSString *cellidentifier = @ "Cellidentifier";    Nsdictionary *dictionary = [Tablearray objectAtIndex:indexPath.row];    Tableviewcell *cell = [TableView dequeuereusablecellwithidentifier:cellidentifier];    if (Cell==nil)    {        cell =  [[nsbundle Mainbundle] loadnibnamed:@ "Tableviewcell" Owner:nil options:nil][0];    }    cell = [cell setcelldictionary:dictionary];    return cell;}



Finally, there is a place where we finish tableview the third picture, there is no content, but there is a table line, then we how to do it.

Just add one word.

Self.tablefooterview = [[UIView alloc]init];

Self is tableview;


The other is nothing, mainly to help, wrote two interface, record a bit of unskilled place;

Interface code: http://download.csdn.net/detail/u010123208/8013673


Simple iOS Mini-interface

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.