在最后一个欢迎界面上添加一个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. [CareerCup] 10.6 Find Duplicate URLs 找重复的URL链接

    10.6 You have 10 billion URLs. How do you detect the duplicate documents? In this case, assume that ...

  2. 20145215《Java程序设计》课程总结

    20145215<Java程序设计>课程总结 每周读书笔记链接汇总 20145215<Java程序设计>第一周学习总结 20145215<Java程序设计>第二周学 ...

  3. vs2015发现一个字符串拼接 bug

    VS2015支持 字符串拼接 如下: string user="test"; int password=123; string sql=$" user={user};pa ...

  4. 如何区分 OpenStack Neutron Extension 和 Plugin

    Neutron 里面的 extension 和 plugin 是非常相似的两个概念,我花了好久才貌似搞懂了两者的区别,还不一定完全正确. 在OpenStack 的官网wiki中,可以找到它们两个的定义 ...

  5. JavaScript和html5 canvas生成圆形印章

    代码: function createSeal(id,company,name){ var canvas = document.getElementById(id); var context = ca ...

  6. Object C学习笔记20-结构体

    在学习Object C中的过程中,关于struct的资料貌似非常少,查阅了C方面的资料总结了一些学习心得! 一. 定义结构 结构体是一种数据类型的组合和数据抽象.结构体的定义语法如下: struct ...

  7. node的实践(项目一)

    学习一门语言,我们先要学习他的基本的语法,基本的数据类型,基本的数组操作,字符串的操作,然后就是语言的特性,实现共享和降低耦合的方式,然后开始比较高级的学习(所有语言都是一样的),比如说通信方法,tc ...

  8. js遍历json数据

    先看看json返回的数据结构: 我需要遍历取出bookreno   与  title  加载到页面容器中去 首先我要取到 recommendedBookList  字典结构数据,然后遍历反射到相应对象 ...

  9. 开放封闭原则(OCP,Open Closed Principle)

    tks:http://www.cnblogs.com/Benjamin/p/3251987.html

  10. 编写高质量代码改善C#程序的157个建议[IEnumerable<T>和IQueryable<T>、LINQ避免迭代、LINQ替代迭代]

    前言 本文已更新至http://www.cnblogs.com/aehyok/p/3624579.html .本文主要学习记录以下内容: 建议29.区别LINQ查询中的IEnumerable<T ...