新浪微博客户端(11)-自定义checkBox
在最后一个欢迎界面上添加一个CheckBox.
// 2.添加4个UIImageView
for (int i = ; i < NEW_FEATURE_NUMS; i++) {
UIImageView *imageView = [[UIImageView alloc] init];
imageView.size = scrollView.size;
imageView.y = ;
imageView.x = i * scrollW;
NSString *imageName = [NSString stringWithFormat:@"new_feature_%d",i+];
imageView.image = [UIImage imageNamed:imageName];
[scrollView addSubview:imageView]; // 如果是最后一张图片,则添加进入按钮
if (i == NEW_FEATURE_NUMS - ) {
[self setupEnterBtn:imageView];
} }
/** 添加分享checkbox及进入微博按钮 */
- (void)setupEnterBtn:(UIImageView *)imageView { // 0.设置imageView可以交互
imageView.userInteractionEnabled = YES; // 1.添加shareBtn
UIButton *shareBtn = [[UIButton alloc] init];
[shareBtn setImage:[UIImage imageNamed:@"checkbox_unchecked"] forState:UIControlStateNormal];
[shareBtn setImage:[UIImage imageNamed:@"checkbox_checked"] forState:UIControlStateSelected]; [shareBtn setTitle:@"分享到微博" forState:UIControlStateNormal];
[shareBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
shareBtn.titleLabel.font = [UIFont systemFontOfSize:];
shareBtn.titleEdgeInsets = UIEdgeInsetsMake(, , , );
shareBtn.width = ;
shareBtn.height = ;
shareBtn.centerX = imageView.width * 0.5;
shareBtn.centerY = imageView.height * 0.75;
[shareBtn addTarget:self action:@selector(shareBtnClick:) forControlEvents:UIControlEventTouchUpInside]; [imageView addSubview:shareBtn]; // 2.添加进入微博按钮
UIButton *enterBtn = [[UIButton alloc] init];
[enterBtn setBackgroundImage:[UIImage imageNamed:@"new_feature_button"] forState:UIControlStateNormal];
[enterBtn setBackgroundImage:[UIImage imageNamed:@"new_feature_button_highlighted"] forState:UIControlStateHighlighted];
enterBtn.size = enterBtn.currentBackgroundImage.size;
enterBtn.centerX = shareBtn.centerX;
enterBtn.centerY = imageView.height * 0.82;
[imageView addSubview:enterBtn]; } - (void)shareBtnClick:(UIButton *)btn { btn.selected = !btn.isSelected; DJLog(@"fdfd"); }
最终效果:
新浪微博客户端(11)-自定义checkBox的更多相关文章
- 新浪微博客户端(2)-自定义导航控制器,统一NavigationItem
继承系统提供的UINavigationViewController,拦截并重写其push方法. #import "DJNavigationController.h" @impl ...
- 新浪微博客户端(5)-自定义UISearchBar
iOS自带的UISearchBar有很多限制,我们可以使用UITextField做出一个类似于SearchBar的效果. //===================================== ...
- 新浪微博客户端(36)-自定义带placeholder的TextView
iOS 上自带的UITextView竟然不能设置placeholder,但是UITextView却可以,我也真是醉了.没办法了,自己写一个 DJTextView.h #import <UIKit ...
- Android应用--新浪微博客户端新特性滚动视图和启动界面实现
新浪微博客户端新特性滚动视图和启动界面实现 2013年8月20日新浪微博客户端开发之启动界面实现 前言: 使用过新浪微博客户端的童鞋都清楚,客户端每一次升级之后第一次启动界面就会有新特性的介绍,用户通 ...
- android开发新浪微博客户端 完整攻略 [新手必读]
开始接触学习android已经有3个礼拜了,一直都是对着android的sdk文档写Tutorials从Hello World到Notepad Tutorial算是初步入门了吧,刚好最近对微博感兴趣就 ...
- 自定义 checkbox 新玩法 ?
自定义 checkbox 新玩法 ? 第一步:selector 编写 drawable/selector_checkbox_voice.xml <?xml version="1.0&q ...
- Yii提供的Htmler助手checkboxList可自定义Checkbox输出格式
foreach($catetags as $cate){ echo Html::checkboxList('category_id','',$cate,['item'=>'customCheck ...
- jquery validate自定义checkbox验证规则和样式
参考:http://blog.csdn.net/xh16319/article/details/9987847 自定义checkbox验证,“检查checkbox是否选中” jQuery.valida ...
- Aisen仿新浪微博客户端项目源码
新浪目前已经限制了第三方微博的很多API接口,加上平常时间不够,所以后续可能不会面向产品的去维护Aisen,不过也有了一些新的方向,例如引入最新Android-support-library,在一个完 ...
随机推荐
- python数字图像处理(2):图像的读取、显示与保存
skimage提供了io模块,顾名思义,这个模块是用来图片输入输出操作的.为了方便练习,也提供一个data模块,里面嵌套了一些示例图片,我们可以直接使用. 引入skimage模块可用: from sk ...
- ubuntu16.04下安装jdk和android studio
1首先要在JDK官网下载对应的Linux的JDK版本.进入该网站后,先选择Accept License Agreement然后即可下载.本人的Linux系统为ubuntukylin 16.04 64 ...
- 接收content-type:multipart/form-data类型的参数
一.问题描述 最近在写接口程序,该接口需要与其他公司的程序对接.对方发送content-type:multipart/form-data类型的参数,结果通过request.getParameter(p ...
- c#中的var优缺点和适用场景
var是c# 3.0新加的特性,叫做隐式类型局部变量,大家都知道c#其实是一种强类型的语言,为什么会引入匿名类型呢? 我猜测是因为linq的原因吧,因为感觉var在linq中被大量使用.下面说下var ...
- vim环境设置和自动对齐
只要在 /etc/vimrc中加上这两句就行了set autoindentset smartindent------------------------------------------------ ...
- 【MyEclipse 2015】 逆向破解实录系列【1】(纯研究)
声明 My Eclipse 2015 程序版权为Genuitec, L.L.C所有. My Eclipse 2015 的注册码.激活码等授权为Genuitec, L.L.C及其付费用户所有. 本文只从 ...
- [C/C++基础] C语言常用函数strlen的使用方法
函数声明:extern unsigned int strlen(char *s); 所属函数库:<string.h> 功能:返回s所指的字符串的长度,其中字符串必须以’\0’结尾 参数:s ...
- 第三十九课:requestAnimationFrame详解
大家应该都知道,如果一个页面运行的定时器很多,无论你怎么优化,最后肯定会超过指定时间才能完成动画.定时器越多,延时越严重. 为此,YUI,kissy等采用中央队列的方式,将定时器减少至一个.浏览器厂商 ...
- AngularJS——grunt神器的安装
前言: 刚开始学 angularJS,在慕课网上看的大漠老师的视频(http://www.imooc.com/learn/156),里面刚开始讲述了前端开发-调试-测试所使用的手段和工具,本人对前端开 ...
- java操作mysql中的编码问题解决
要注意以下几点 1.在连接mysql数据库时 jdbc:mysql://localhost:3306/xiaonei?useUnicode=true&characterEncoding=utf ...