iOS Add controls

Source: Internet
Author: User

Yjqapp *appinfo =Self.apps[i]; //. Add a pictureUiimageview * IconView =[[Uiimageview alloc]init]; CGFloat iconw= A; CGFloat Iconh= -; CGFloat IconX= (APPW-ICONW) *0.5; CGFloat Icony=0; Iconview.frame=CGRectMake (IconX, Icony, Iconw, Iconh); Iconview.image=[UIImage ImageNamed:appInfo.icon];                [Appview Addsubview:iconview]; //. Add textUILabel * Namelabel =[[UILabel alloc] init]; CGFloat Namew=APPW; CGFloat Nameh= -; CGFloat NameX=0; CGFloat Namey= icony+Iconh; Namelabel.frame=CGRectMake (NameX, Namey, Namew, Nameh); Namelabel.text=Appinfo.icon; Namelabel.font=[uifont systemfontofsize: -]; Namelabel.textalignment=Nstextalignmentcenter;                [Appview Addsubview:namelabel]; //. Add a buttonUIButton * downloadbtn =[[UIButton alloc]init]; CGFloat DOWNLOADX= A; CGFloat Downloady=namey+Nameh; CGFloat DOWNLOADW=appw-2*DOWNLOADX; CGFloat downloadh= -; Downloadbtn.frame=CGRectMake (DOWNLOADX, Downloady, DOWNLOADW, downloadh); //Set the default backgroundUIImage * Normalimage = [UIImage imagenamed:@"cc"];                        [Downloadbtn setbackgroundimage:normalimage Forstate:uicontrolstatenormal]; //Set highlight BackgroundUIImage * Highimage =[uiimage imagenamed:@"cc"];                [Downloadbtn setbackgroundimage:highimage forstate:uicontrolstatehighlighted]; //Set Text[Downloadbtn Settitle:@ "CC"Forstate:uicontrolstatenormal]; //set the article fontDownloadbtn.titlelabel.font=[uifont systemfontofsize: -]; [Appview ADDSUBVIEW:DOWNLOADBTN];



-(nsarray *) apps{

if(_apps= =Nil) {

// get plist file full path

nsstring * Path = [[nsbundle mainbundle] pathforresource:@ "App.plist" OfType:nil];

Nsarray * dicarray =[nsarray arraywithcontentsoffile:p ath];

Nsmutablearray * appaarry =[nsmutablearray array];

For  (nsdictionaryin dicarray) {    
Yjqapp * app = [yjqappappwithdict:d ic];   

[Appaarry AddObject: app];

}

_apps = appaarry;

}

return _apps;

}

iOS Add controls

Related Article

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.