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