山寨今日头条的标题title效果

效果:

源码:

//
// ViewController.m
// 今日头条
//
// Created by YouXianMing on 14/11/26.
// Copyright (c) 2014年 YouXianMing. All rights reserved.
// #import "ViewController.h" @interface ViewController ()<UIScrollViewDelegate>
@property (nonatomic, strong) UIScrollView *scrollView;
@property (nonatomic, strong) UIView *alphaView;
@end @implementation ViewController - (void)viewDidLoad {
[super viewDidLoad]; [self.view addSubview:[self theSubView]];
[self.view addSubview:[self theFrontView]]; self.scrollView = [[UIScrollView alloc] initWithFrame:self.view.bounds];
self.scrollView.delegate = self;
self.scrollView.pagingEnabled = YES;
self.scrollView.contentSize = CGSizeMake(self.scrollView.bounds.size.width * ,
self.scrollView.bounds.size.height);
[self.view addSubview:self.scrollView];
} - (void)scrollViewDidScroll:(UIScrollView *)scrollView {
CGRect rect = self.alphaView.frame;
rect.origin.x = scrollView.contentOffset.x / .f;
self.alphaView.frame = rect;
} - (UIView *)theSubView {
// 添加前景色
UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(, , , )];
backView.backgroundColor = [UIColor colorWithRed:0.922 green:0.922 blue:0.922 alpha:];
[self.view addSubview:backView]; // 标题1
UILabel *title1 = [[UILabel alloc] initWithFrame:CGRectMake(, , , )];
title1.text = @"今日头条";
title1.textAlignment = NSTextAlignmentCenter;
title1.font = [UIFont systemFontOfSize:.f];
title1.textColor = [UIColor colorWithRed:0.443 green:0.439 blue:0.439 alpha:];
[backView addSubview:title1]; // 标题2
UILabel *title2 = [[UILabel alloc] initWithFrame:CGRectMake(, , , )];
title2.text = @"YouXianMing";
title2.textAlignment = NSTextAlignmentCenter;
title2.font = [UIFont systemFontOfSize:.f];
title2.textColor = [UIColor colorWithRed:0.443 green:0.439 blue:0.439 alpha:];
[backView addSubview:title2]; return backView;
} - (UIView *)theFrontView {
// 添加前景色
UIView *backView = [[UIView alloc] initWithFrame:CGRectMake(, , , )];
backView.backgroundColor = [UIColor colorWithRed:0.808 green:0.208 blue:0.212 alpha:];
[self.view addSubview:backView]; // 标题1
UILabel *title1 = [[UILabel alloc] initWithFrame:CGRectMake(, , , )];
title1.text = @"今日头条";
title1.textAlignment = NSTextAlignmentCenter;
title1.font = [UIFont systemFontOfSize:.f];
title1.textColor = [UIColor colorWithRed:0.945 green:0.827 blue:0.827 alpha:];
[backView addSubview:title1]; // 标题2
UILabel *title2 = [[UILabel alloc] initWithFrame:CGRectMake(, , , )];
title2.text = @"YouXianMing";
title2.textAlignment = NSTextAlignmentCenter;
title2.font = [UIFont systemFontOfSize:.f];
title2.textColor = [UIColor colorWithRed:0.945 green:0.827 blue:0.827 alpha:];
[backView addSubview:title2]; self.alphaView = [[UIView alloc] initWithFrame:CGRectMake(, , , )];
self.alphaView.backgroundColor = [UIColor blackColor];
self.alphaView.layer.cornerRadius = .f;
backView.maskView = self.alphaView; return backView;
} @end

图片:

一切尽在不言中:)

山寨今日头条的标题title效果的更多相关文章

  1. tab切换的效果——仿照今日头条APP的切换效果

    说点废话;不知道是哪一版本起头条的tab切换效果就变了,一直琢磨着这个事,去度娘那里也没有什么结果:正好这两天有空就尝试做了一下:用前端的技术来实现: 先看效果吧:上面的tab随着slide滑动,上面 ...

  2. Android之仿今日头条顶部导航栏效果

    随着时间的推移现在的软件要求显示的内容越来越多,所以要在小的屏幕上能够更好的显示更多的内容,首先我们会想到底部菜单栏,但是有时候像今日头条新闻客户端要显示的内容太多,而且又想在主界面全部显示出来,所以 ...

  3. 自定义控件实现-今日头条Android APP图集效果

    前提 产品有个新需求,类似今日头条的图集效果 大致看了下UI,大致就是ViewPager,横向滑动切换图片,纵向滑动移动图片,纵向超过一定距离,图片飞出,图集淡出动画退出,支持图片的双击放大. 思路 ...

  4. jq+swiper 实现今日头条App的选项卡效果

    <!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...

  5. Python3:爬取新浪、网易、今日头条、UC四大网站新闻标题及内容

    Python3:爬取新浪.网易.今日头条.UC四大网站新闻标题及内容 以爬取相应网站的社会新闻内容为例: 一.新浪: 新浪网的新闻比较好爬取,我是用BeautifulSoup直接解析的,它并没有使用J ...

  6. [Android] Android 类似今日头条顶部的TabLayout 滑动标签栏 效果

    APP市场中大多数新闻App都有导航菜单,导航菜单是一组标签的集合,在新闻客户端中,每个标签标示一个新闻类别,对应下面ViewPager控件的一个分页面,今日头条, 网易新闻等. 本文主要讲的是用:T ...

  7. android仿今日头条App、多种漂亮加载效果、选择器汇总、记事本App、Kotlin开发等源码

    Android精选源码 android漂亮的加载效果 android各种 选择器 汇总源码 Android仿bilibili搜索框效果 Android记事本app.分类,涂鸦.添加图片或者其他附件 仿 ...

  8. iOS高仿微信悬浮窗、忍者小猪游戏、音乐播放器、支付宝、今日头条布局滚动效果等源码

    iOS精选源码 iOS WKWebView的使用源码 模仿apple music 小播放器的交互实现 高仿微信的悬浮小窗口 iOS仿支付宝首页效果 [swift]仿微信悬浮窗 类似于今日头条,网易新闻 ...

  9. 仿今日头条最强顶部导航指示器,支持6种模式-b

    项目中经常会用到类似今日头条中顶部的导航指示器,我也经常用一个类似的库PagerSlidingTabStrip,但是有时并不能小伙伴们的所有需求,所以我在这个类的基础上就所有能用到的情况做了一个简单的 ...

随机推荐

  1. 机器学习--boosting家族之Adaboost算法

    最近在系统研究集成学习,到Adaboost算法这块,一直不能理解,直到看到一篇博文,才有种豁然开朗的感觉,真的讲得特别好,原文地址是(http://blog.csdn.net/guyuealian/a ...

  2. VUE自定义指令生命周期,VUE生命周期

    一.自定义指令的生命周期 自定义指令有五个生命周期(也叫钩子函数),分别是 bind,inserted,update,componentUpdated,unbind bind:只调用一次,指令第一次绑 ...

  3. SSH 整合 (Maven)

    1.SSH 教程详见我的上一篇博客 SSH(Struts 2.3.31 + Spring 4.1.6 + Hibernate 5.0.12 + Ajax)框架整合实现简单的增删改查(包含分页,Ajax ...

  4. c# winform项目用到的部分知识点总结

    项目用到的知识点总结,欢迎大家吐槽: /// <summary> /// 转换非yyyy-MM-dd的字符串为DateTime类型 /// </summary> public ...

  5. Shell脚本编写5-----Shell 基本运算符

    算术运算符 原生bash不支持简单的数学运算,但是可以通过其他命令来实现,例如 awk 和 expr,expr 最常用.expr 是一款表达式计算工具,使用它能完成表达式的求值操作.例如: 两个数相加 ...

  6. BG.Hadoop.Master

    1. 安装JDK JDK安装包复制到/opt文件夹 cd /opt rpm -ivh jdk-8u121-linux-x64.rpm vim /etc/profile 增加 JAVA_HOME=/us ...

  7. 父页面向iframe子页面传递参数

    父页面: <iframe src="video.html" width="100%" height="400" name=" ...

  8. [转]使用C#进行图像处理的几种方法

    最近做监控图像由彩色变灰处理的时候发现图像处理过程中,很慢很慢代码如下: int Height = this.picInfo.Image.Height;                    int ...

  9. SPA应用部署时首屏启动慢问题解决方案

    SPA应用部署时首屏启动慢问题解决方案 使用vuejs开发的单页应用,打包部署上线后,发现首屏启动时间达到了惊人的10s左右,于是开始优化,目前使用到的总结如下: 巧用webpack插件 1.抽取cs ...

  10. 线程7--GCD的基本使用

    子线程执行延时操作,执行完成后返回主线程更新界面 dispatch_queue_t queue=dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DE ...