YJQApp *appInfo =self.apps[i]; //.添加图片
UIImageView * iconView = [[UIImageView alloc]init];
CGFloat iconW= ;
CGFloat iconH =;
CGFloat iconX =(appW-iconW)*0.5;
CGFloat iconY=;
iconView.frame=CGRectMake(iconX, iconY, iconW, iconH); iconView.image = [UIImage imageNamed:appInfo.icon];
[appView addSubview:iconView]; //.添加文字
UILabel * nameLabel =[[UILabel alloc] init];
CGFloat nameW = appW;
CGFloat nameH = ;
CGFloat nameX = ;
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]; //. 添加按钮
UIButton * downloadBtn =[[UIButton alloc]init];
CGFloat downloadX=;
CGFloat downloadY=nameY+nameH;
CGFloat downloadW=appW-*downloadX;
CGFloat downloadH=;
downloadBtn.frame = CGRectMake(downloadX, downloadY, downloadW, downloadH); //设置默认背景
UIImage * normalImage = [UIImage imageNamed:@"cc"];
[downloadBtn setBackgroundImage: normalImage forState:UIControlStateNormal]; //设置高亮背景
UIImage * highImage =[UIImage imageNamed:@"cc"];
[downloadBtn setBackgroundImage:highImage forState:UIControlStateHighlighted]; //设置文字
[downloadBtn setTitle:@"cc" forState:UIControlStateNormal]; //设置文章字体
downloadBtn.titleLabel.font=[UIFont systemFontOfSize:]; [appView addSubview:downloadBtn];
- (NSArray *)apps{
if(_apps==nil){
//获取plist文件 全路径
NSString * path = [[NSBundle mainBundle] pathForResource:@"app.plist" ofType:nil];
NSArray * dicArray =[NSArray arrayWithContentsOfFile:path];
NSMutableArray * appAarry =[NSMutableArray array];
for(NSDictionary * dic in dicArray){
YJQApp * app = [YJQApp appWithDict:dic];
[appAarry addObject:app];
}
_apps = appAarry;
}
return _apps;
}