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;


}

 

IOS添加控件的更多相关文章

  1. 关于IOS某图片添加控件,图片从相册或拍照保存后,再次进入时点击放大图无法显示的问题

    某图片添加控件: https://github.com/XZTLLQ/LQPhotoPickerDemo 问题: 标题已说明 代码块: NSArray *alAssetUrl =(NSMutableA ...

  2. JS调用Android、Ios原生控件

    在上一篇博客中已经和大家聊了,关于JS与Android.Ios原生控件之间相互通信的详细代码实现,今天我们一起聊一下JS调用Android.Ios通信的相同点和不同点,以便帮助我们在进行混合式开发时, ...

  3. IOS—UITextFiled控件详解

    IOS—UITextFiled控件详解 //初始化textfield并设置位置及大小 UITextField *text = [[UITextField alloc]initWithFrame:CGR ...

  4. [iOS基础控件 - 5.5] 代理设计模式 (基于”APP列表"练习)

    A.概述      在"[iOS基础控件 - 4.4] APP列表 进一步封装,初见MVC模式”上进一步改进,给“下载”按钮加上效果.功能      1.按钮点击后,显示为“已下载”,并且不 ...

  5. 给jquery-validation插件添加控件的验证回调方法

    jquery-validation.js在前端验证中使用起来非常方便,提供的功能基本上能满足大部分验证需求,例如:1.内置了很多常用的验证方法:2.可以自定义错误显示信息:3.可以自定义错误显示位置: ...

  6. 初识IOS,Label控件的应用。

    初识IOS,Label控件的应用. // // ViewController.m // Gua.test // // Created by 郭美男 on 16/5/31. // Copyright © ...

  7. winform 用户控件、 动态创建添加控件、timer控件、控件联动

    用户控件: 相当于自定义的一个panel 里面可以放各种其他控件,并可以在后台一下调用整个此自定义控件. 使用方法:在项目上右键.添加.用户控件,之后用户控件的编辑与普通容器控件类似.如果要在后台往窗 ...

  8. WinForm用户控件、动态创建添加控件、timer控件--2016年12月12日

    好文要顶 关注我 收藏该文 徐淳 关注 - 1 粉丝 - 3       0 0     用户控件: 通过布局将多个控件整合为一个控件,根据自己的需要进行修改,可对用户控件内的所有控件及控件属性进行修 ...

  9. Pyqt 动态的添加控件

    Pyqt 动态的添加控件 # -*- coding: utf-8 -*- from PyQt4.QtCore import * from PyQt4.QtGui import * import sys ...

随机推荐

  1. PS-文字如何竖排版

    单击文字输入工具“T”按钮,点住鼠标左键不要松手,会在“T”按钮的右边显示出其它形式的文字工具,拖动鼠标指向“直排文字”工具就可以了.

  2. git常见问题

    一.设置git的user name和email: git config --global user.name "lei.li" git config --global user.e ...

  3. Understanding Linux Kernel version 3 读书笔记

    P30, preemptive  kernel .kernel threading 和Multithreaded application support没太好理解,我想如果设计个多线程的程序来运行运行 ...

  4. 【JavaScript】Understanding callback functions in Javascript

    Callback functions are extremely important in Javascript. They’re pretty much everywhere. Originally ...

  5. 【JavaScript】你知道吗?Web的26项基本概念和技术

    Web开发是比较费神的,需要掌握很多很多的东西,特别是从事前端开发的朋友,需要通十行才行.今天,本文向初学者介绍一些Web开发中的基本概念和用到的技术,从A到Z总共26项,每项对应一个概念或者技术. ...

  6. PHP 自动生成导航网址的最佳方法 v20130826

    经常制作开发不同的网站的后台,写过很多种不同的后台导航写法. 最终积累了这种最写法,算是最好的吧.附上截图和代码如下(PHP+HTML) <?php $linkArr = array( 'ind ...

  7. 疑难杂症:java.lang.AbstractMethodError: org.apache.xerces.dom.DocumentImpl.setXmlVersion(Ljava/lang/String;)V

    错误: java.lang.AbstractMethodError: org.apache.xerces.dom.DocumentImpl.setXmlVersion(Ljava/lang/Strin ...

  8. Cloudera Error: "Failed to handle Heartbeat Response"

    在使用cloudera manager安装CDH过程中,发现安装进程卡在给某个slave机分配parcel上. 查agent的log发现如下错: ...MainThread agent ERROR F ...

  9. Android 自定义组合控件

    1, you need to add this kind of code to the constructors of your custom view which must extend ViewG ...

  10. C++面向对象设计

    一. 组合(复合),继承,委托 1.composition(组合)has-a 1.1 组合举例:(Adapter 设计模式) 关系: 利用deque功能实现所有queue功能 template < ...