在最后一个欢迎界面上添加一个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. MATLAB元胞数组

    MATLAB元胞数组 元胞数组: 元胞数组是MATLAB的一种特殊数据类型,可以将元胞数组看做一种无所不包的通用矩阵,或者叫做广义矩阵.组成元胞数组的元素可以是任何一种数据类型的常数或者常量,每一个元 ...

  2. Opencv step by step - 阈值化

    Opencv里面的阈值化做起来比较简单,只需要一个函数即可: /* Applies fixed-level threshold to grayscale image. This is a basic ...

  3. python实现简易数据库之一——存储和索引建立

    最近没事做了一个数据库project,要求实现一个简单的数据库,能满足几个特定的查询,这里主要介绍一下我们的实现过程,代码放在过ithub,可参看这里.都说python的运行速度很慢,但因为时间比较急 ...

  4. WP & Win10开发:实现ListView下拉加载的两种方法

    1.通过ListView控件的ContainerContentChanging方法.该方法在列表项被实例化时触发,在列表项最后一个项目实例化的时候触发刷新数据逻辑就可以实现下拉加载了. 代码如下:// ...

  5. redis async client 与自有框架集成

    hiredis的异步接口已经支持ae libuv libev 和 libevent集成,具体头文件可以参见redis/deps/hiredis/adapters,样例参见redis/deps/hire ...

  6. Mac无法找到摄像头问题解决

    facetime显示“未检测到摄像头”之类的,重启后可能摄像头有工作正常了,摄像头不稳定 重置 NVRAM后恢复正常,据说机器卡的时候,此法也可以使用. https://support.apple.c ...

  7. javascript基础知识拾遗

    1 下面列出的值被当作假 false null undefined '' 0 NaN 其它所有值被当作是真 console.log(undefined || true); //true console ...

  8. JS函数表达式

    导图

  9. JS面向对象高级特性

    本篇是通过学习视频<一头扎进javascirpt高级篇>整理的一些相关知识,大致包括下面几个方面: 1 对象的创建方法 2 对象的对象属性.私有属性.类属性 3 对象的对象方法.私有方法. ...

  10. linux编译ruby1.8.7 出现OPENSSL错误

    安装ruby-1.8.7出现编译错误.如下: ossl_pkey_ec.c:815: error: ‘EC_GROUP_new_curve_GF2m’ undeclared (first use in ...