山寨今日头条的标题title效果
山寨今日头条的标题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效果的更多相关文章
- tab切换的效果——仿照今日头条APP的切换效果
说点废话;不知道是哪一版本起头条的tab切换效果就变了,一直琢磨着这个事,去度娘那里也没有什么结果:正好这两天有空就尝试做了一下:用前端的技术来实现: 先看效果吧:上面的tab随着slide滑动,上面 ...
- Android之仿今日头条顶部导航栏效果
随着时间的推移现在的软件要求显示的内容越来越多,所以要在小的屏幕上能够更好的显示更多的内容,首先我们会想到底部菜单栏,但是有时候像今日头条新闻客户端要显示的内容太多,而且又想在主界面全部显示出来,所以 ...
- 自定义控件实现-今日头条Android APP图集效果
前提 产品有个新需求,类似今日头条的图集效果 大致看了下UI,大致就是ViewPager,横向滑动切换图片,纵向滑动移动图片,纵向超过一定距离,图片飞出,图集淡出动画退出,支持图片的双击放大. 思路 ...
- jq+swiper 实现今日头条App的选项卡效果
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content ...
- Python3:爬取新浪、网易、今日头条、UC四大网站新闻标题及内容
Python3:爬取新浪.网易.今日头条.UC四大网站新闻标题及内容 以爬取相应网站的社会新闻内容为例: 一.新浪: 新浪网的新闻比较好爬取,我是用BeautifulSoup直接解析的,它并没有使用J ...
- [Android] Android 类似今日头条顶部的TabLayout 滑动标签栏 效果
APP市场中大多数新闻App都有导航菜单,导航菜单是一组标签的集合,在新闻客户端中,每个标签标示一个新闻类别,对应下面ViewPager控件的一个分页面,今日头条, 网易新闻等. 本文主要讲的是用:T ...
- android仿今日头条App、多种漂亮加载效果、选择器汇总、记事本App、Kotlin开发等源码
Android精选源码 android漂亮的加载效果 android各种 选择器 汇总源码 Android仿bilibili搜索框效果 Android记事本app.分类,涂鸦.添加图片或者其他附件 仿 ...
- iOS高仿微信悬浮窗、忍者小猪游戏、音乐播放器、支付宝、今日头条布局滚动效果等源码
iOS精选源码 iOS WKWebView的使用源码 模仿apple music 小播放器的交互实现 高仿微信的悬浮小窗口 iOS仿支付宝首页效果 [swift]仿微信悬浮窗 类似于今日头条,网易新闻 ...
- 仿今日头条最强顶部导航指示器,支持6种模式-b
项目中经常会用到类似今日头条中顶部的导航指示器,我也经常用一个类似的库PagerSlidingTabStrip,但是有时并不能小伙伴们的所有需求,所以我在这个类的基础上就所有能用到的情况做了一个简单的 ...
随机推荐
- JS浮点数精确计算方法
function add(a, b) { var c, d, e; try { c = a.toString().split(".")[1].length; } catch (f) ...
- openTSDB(转)
1.OpenTSDB介绍 1.1.OpenTSDB是什么?主要用途是什么? 官方文档这样描述:OpenTSDB is a distributed, scalable Time Series Datab ...
- HTTPClient 超时链接设置
远程访问链接,设置时间,从而减少不必要的麻烦,但是HttpClient版本不一致,方法不一样,所以有了如下设置 原帖链接:https://www.cnblogs.com/jimmy-muyuan/p/ ...
- thinkphp 页面静态化
页面静态化(代码在最后) 静态页面 是网页的代码都在页面中,不需要执行asp,php,jsp,.net等程序生成客户端网页代码的网页,静态页面网址中一般不含“?”.“=”.“&”等特殊符号. ...
- Jade——变体的HTML
什么是jade? jade是一个模板引擎,是变体的HTML. 模板引擎就是一个库,用来解释素具渲染视图的框架,也可以叫做HTML的预处理语言. jade是Node.js的一个模板引擎,他的语法借鉴了H ...
- IE浏览器TAB清空设置
1.Regedit 2.HKEY_USERS——搜索NewTabPage 3.清空除了Default之外的所有东西 4.也可以添加NumRows——TAB的行数 可以参考:http://tieba.b ...
- 打造自己的LinQProvider(四)
打造自己的LinqProvider *:first-child { margin-top: 0 !important; } body>*:last-child { margin-bottom: ...
- 转载:@Html.ValidationSummary(true)
ASP.NET MVC3 Model验证总结 @Html.ValidationSummary(true) http://www.wyjexplorer.cn/Post/2012/8/3/model ...
- Servlet的数据库访问
创建数据库: import java.sql.*; public class SqlUtil { static { try { Class.forName("com.mysql.jdbc ...
- java基础之运算符与语句
一.运算符 1.算数运算符 运算符 名称 举例 + 加法 A等于10,B等于3 则A+B=13 - 减法 A等于10,B等于3 则A-B=7 * 乘法 A等于10,B等于3 则A*B=30 / 除法 ...