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. Cross-Browser HTML5 Placeholder Text

    One of the nice enhancement in HTML5 web form is being able to add placeholder text to input fields. ...

  2. 在sphinx中应用复杂过滤条件

    一.问题的引入   在sphinx应用中,需要对数据进行复杂的条件过滤,刷选出我们需要的数据.这个过程,等同于mysql查询中的where条件.   但sphinx本身的filter并不能支持复杂的逻 ...

  3. 学习马士兵的struts2/hibernate/spring中遇到的问题及其解决方法

    STRUTS2 1. 写好最简单的hello world项目后,无法通过浏览器访问到hello.jsp页面,提示没有资源. 学习structs2的时间,已经更新到了2.3.16了,structs中的很 ...

  4. BZOJ 1061: [Noi2008]志愿者招募 费用流

    1061: [Noi2008]志愿者招募 题目连接: http://www.lydsy.com/JudgeOnline/problem.php?id=1061 Description 申奥成功后,布布 ...

  5. iOS开发——网络实用技术OC篇&网络爬虫-使用java语言抓取网络数据

    网络爬虫-使用java语言抓取网络数据 前提:熟悉java语法(能看懂就行) 准备阶段:从网页中获取html代码 实战阶段:将对应的html代码使用java语言解析出来,最后保存到plist文件 上一 ...

  6. android Unable to instantiate application

    最近一段时间在做项目时候遇到一个错误老是解决不了,log如下: FATAL EXCEPTION: main12-11 09:08:53.922 E/AndroidRuntime( 1227): jav ...

  7. mysql 升级方法

    Performing an In-place Upgrade This section describes how to perform an in-place upgrade. Review Bef ...

  8. Golang学习 - regexp 包

    ------------------------------------------------------------ // 函数 // 判断在 b(s.r)中能否找到 pattern 所匹配的字符 ...

  9. Android设置窗口、控件透明度

    设置透明效果的方法如下: 1.在布局文中设置透明效果 android:background="@android:color/transparent" (通过android自带颜色设 ...

  10. Android基本控件之listView(三)<用ListView实现分页加载>

    我们之前讨论了ListView的基本使用方法和ListView的优化 今天我们再来讨论一个关于ListView的一个新的东西~就是分页加载.那么什么是分页加载呢?简单点说,就是"下拉刷新&q ...