在最后一个欢迎界面上添加一个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的更多相关文章

  1. 新浪微博客户端(2)-自定义导航控制器,统一NavigationItem

      继承系统提供的UINavigationViewController,拦截并重写其push方法. #import "DJNavigationController.h" @impl ...

  2. 新浪微博客户端(5)-自定义UISearchBar

    iOS自带的UISearchBar有很多限制,我们可以使用UITextField做出一个类似于SearchBar的效果. //===================================== ...

  3. 新浪微博客户端(36)-自定义带placeholder的TextView

    iOS 上自带的UITextView竟然不能设置placeholder,但是UITextView却可以,我也真是醉了.没办法了,自己写一个 DJTextView.h #import <UIKit ...

  4. Android应用--新浪微博客户端新特性滚动视图和启动界面实现

    新浪微博客户端新特性滚动视图和启动界面实现 2013年8月20日新浪微博客户端开发之启动界面实现 前言: 使用过新浪微博客户端的童鞋都清楚,客户端每一次升级之后第一次启动界面就会有新特性的介绍,用户通 ...

  5. android开发新浪微博客户端 完整攻略 [新手必读]

    开始接触学习android已经有3个礼拜了,一直都是对着android的sdk文档写Tutorials从Hello World到Notepad Tutorial算是初步入门了吧,刚好最近对微博感兴趣就 ...

  6. 自定义 checkbox 新玩法 ?

    自定义 checkbox 新玩法 ? 第一步:selector 编写 drawable/selector_checkbox_voice.xml <?xml version="1.0&q ...

  7. Yii提供的Htmler助手checkboxList可自定义Checkbox输出格式

    foreach($catetags as $cate){ echo Html::checkboxList('category_id','',$cate,['item'=>'customCheck ...

  8. jquery validate自定义checkbox验证规则和样式

    参考:http://blog.csdn.net/xh16319/article/details/9987847 自定义checkbox验证,“检查checkbox是否选中” jQuery.valida ...

  9. Aisen仿新浪微博客户端项目源码

    新浪目前已经限制了第三方微博的很多API接口,加上平常时间不够,所以后续可能不会面向产品的去维护Aisen,不过也有了一些新的方向,例如引入最新Android-support-library,在一个完 ...

随机推荐

  1. JS闭包的理解

    闭包的两个特点: 1.作为一个函数变量的一个引用 - 当函数返回时,其处于激活状态.2.一个闭包就是当一个函数返回时,一个没有释放资源的栈区. 其实上面两点可以合成一点,就是闭包函数返回时,该函数内部 ...

  2. 微信小程序全选,微信小程序checkbox,微信小程序购物车

    微信小程序,这里实现微信小程序checkbox,有需要此功能的朋友可以参考下. 摘要: 加减商品数量,汇总价格,全选与全不选 设计思路: 一.从网络上传入以下Json数据格式的数组  1.标题titl ...

  3. 学习笔记——Maven实战(八)常用Maven插件介绍(下)

    我们都知道Maven本质上是一个插件框架,它的核心并不执行任何具体的构建任务,所有这些任务都交给插件来完成,例如编译源代码是由maven- compiler-plugin完成的.进一步说,每个任务对应 ...

  4. Spring Cache和MyBatis的使用

    1.http://www.importnew.com/22757.html    spring chache缓存的使用. 2.http://www.importnew.com/22783.html   ...

  5. Android音乐播放器的开发实例

    本文将引导大家做一个音乐播放器,在做这个Android开发实例的过程中,能够帮助大家进一步熟悉和掌握学过的ListView和其他一些组件.为了有更好的学习效果,其中很多功能我们手动实现,例如音乐播放的 ...

  6. gitlab 配置邮箱

    摘自:http://www.tuicool.com/articles/ruyERz 这里我用的是263企业邮箱 这里我们用smtp发送邮件,要是系统自带有sendmail,我们就给他卸掉,yum re ...

  7. Linq 分页不可缺少的两个方法

    //LINQ分页的方法 //1.获取总页数 public int GetPageCount(int pageSize)//pageSize是每页的行数 { //先查出总共有多少行 int rowCou ...

  8. Xcode7企业版打包

    今天才发现Xcode7企业账号打包竟然和以前稍微不一样了,一时手残,先把公司服务器以前的ipa包删了,吓得我的小心脏呢 首先选中然后选archive然后点export然后然后选中include man ...

  9. Linux_Centos使用mutt+msmtp发送邮件

    一.软件环境 1.centos 6.5 2.msmtp-1.4.32 3.Mutt 1.5.20 (2009-12-10) 二.实现步骤 1.安装配置Mutt $ yum install mutt - ...

  10. ie6下使用js替换img标签src属性图片不显示的错误

    首先,我必须再次强调一下,F-U-C-K I-E! 其次,简单阐述一下这个bug的出现的情况.页面中有个<a href=”javascript:void(0)” onclick=”swapImg ...