山寨今日头条的标题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,但是有时并不能小伙伴们的所有需求,所以我在这个类的基础上就所有能用到的情况做了一个简单的 ...
随机推荐
- 笔记三:python乱码深度剖析一
一:学习内容 python编码转换 python乱码原因深入解析 二:python编码转换 1. Python内部字符串一般都是Unicode编码,代码中字符串的默认编码与代码文件本身的编码是一致的. ...
- python hive.py
#!/usr/bin/env python# -- coding:utf-8 -- import osimport sysfrom subprocess import call from pyspar ...
- 开源项目Log4j
一:Log4j入门简介学习 Log4j是Apache的一个开放源代码项目,通过使用Log4j,我们可以控制日志信息输送的目的地是控制台.文件.GUI组件.甚至是套接口服务器.NT的事件记录器.UNIX ...
- awk把第1列相同的第2列按“;”拼起来,最后输出第1列和拼起来的结果
[root@localhost cc]# cat 2.txt adc 3 5 a d aa 3 adfa d ba 3 adf 第1列相同的第2列按";"拼起来,最后输出第1列和拼 ...
- 设计模式学习--面向对象的5条设计原则之依赖倒置原则--DIP
一.DIP简介(DIP--Dependency Inversion Principle): 1.高层模块不应该依赖于低层模块,二者都应该依赖于抽象.2.抽象不应该依赖于细节,细节应该依赖于抽象. ...
- ILMerge将源DLL合并到目标EXE
ILMerge将源DLL合并到目标EXE(.NET4.6.2) 本文为原创文章,如转载,请在网页明显位置标明原文名称.作者及网址,谢谢! 本文主要是使用微软的ILMerge工具将源DLL合并到目标EX ...
- js小练习
1.题目:某班的成绩出来了,现在老师要把班级的成绩打印出来. 效果如下:xxx年xx月x日 星期x--班级总分为:81 格式要求:1.显示打印的日期.格式为类似“xxxx年xx月xx日 星期x”的当 ...
- 【学习笔记】--- 老男孩学Python,day12 函数名的应用,闭包,迭代器
1, 函数名的应用,第一类对象 函数名可以像变量一样进行使用 1.赋值 def func(): print("你吃了么?") # print(func) # a = func # ...
- Code Signal_练习题_Array Replace
Given an array of integers, replace all the occurrences of elemToReplace with substitutionElem. Exam ...
- 使用vue+webpack打包时,去掉资源前缀
在build文件夹下找到webpack.prod.conf.js文件,搜索 filename: utils.assetsPath('css/[name].[contenthash].css'), 将[ ...