iOS滑动tableView来改变导航栏的颜色
- (void)viewDidLoad {
[super viewDidLoad];
[self initTableView];
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
return 10;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell=[self tableViewZ:self.myTableView cellForRowAtIndexPath:indexPath];
return cell;
}
- (UITableViewCell *)tableViewZ:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
UITableViewCell *cell=[[UITableViewCell alloc]init];
return cell;
}
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
NSLog(@"offset---scroll:%f",self.myTableView.contentOffset.y);
UIColor *color=[UIColor redColor];
CGFloat offset=scrollView.contentOffset.y;
if (offset<0) {
self.navigationController.navigationBar.backgroundColor = [color colorWithAlphaComponent:0];
}else {
CGFloat alpha=1-((64-offset)/64);
self.navigationController.navigationBar.backgroundColor=[color colorWithAlphaComponent:alpha];
}
}
- (void)initTableView{
self.myTableView.delegate=self;
self.myTableView.dataSource=self;
}
iOS滑动tableView来改变导航栏的颜色的更多相关文章
- IOS 改变导航栏返回按钮的标题
IOS 改变导航栏返回按钮的标题 下午又找到了一个新的方法 这个方法不错 暂时没有发现异常的地方. 新写的App中需要使用UINavigationController对各个页面进行导航,但由于第一 ...
- iOS 超 Easy 实现 渐变导航栏
接着上周的项目, 在上周我别出心裁的在自定义TabbarController中加入了自定义转场动画, 受到了大家广泛的喜爱, 再次表示感激, 今天我们继续实现LifestyleViewControll ...
- 微信小程序导航栏,下面内容滑动,上册导航栏跟着滑动,内容随着导航栏滑动
16.类似微信导航栏滑动.png 今日头条导航栏,下面滑动上面跟着滑动 index.wxml <swiper class="content" style="heig ...
- iOS 设置导航栏之二(设置导航栏的颜色、文字的颜色、左边按钮的文字及颜色)
#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicati ...
- iOS 设置导航栏的颜色和导航栏上文字的颜色
#import <UIKit/UIKit.h> @interface AppDelegate : UIResponder <UIApplicationDelegate> @pr ...
- swift设置导航栏item颜色和状态栏颜色
//swift设置导航栏item颜色和状态栏颜色 let dict:Dictionary =[NSForegroundColorAttributeName:UIColor.hrgb("333 ...
- 【iOS开发-22】navigationBar导航栏,navigationItem建立:获取导航栏中的基本文本和button以及各种跳跃
(1)navigationBar导航栏可以被看作是self.navigationController一个属性导航控制器,它可以由点直接表示self.navigationController.navig ...
- iOS导航栏标题颜色
按钮的颜色 [self.navigationBar setTintColor:[UIColor whiteColor]]; 标题颜色.字体 [self.navigationBar setTitleTe ...
- iOS 要定义自己的导航栏button样式Button Image 执行出彩是不一样的与原来的颜色 -解
在相机闪光灯,在导航栏中自己定义"闪"样式.点击变换的图像期望,但一直没有变化.原来是该条款的Global Tint颜色.因此,系统会自己主动改变图片的颜色Global Tint颜 ...
随机推荐
- windows下route命令详解(转载)
1.具体功能 该命令用于在本地IP路由表中显示和修改条目.使用不带参数的ROUTE可以显示帮助. 2.语法详解 route [-f] [-p] [co ...
- jquery 使用ajax,正常返回后,不执行success的问题
背景: 在使用到jQuery的ajax时,如果指定了dataType为json,老是不执行success回调,而是执行了error回调函数. 原因: 然后继续下载了几个jquery版本,如1.3.2, ...
- 04-树4 是否同一棵二叉搜索树(25 point(s)) 【Tree】
04-树4 是否同一棵二叉搜索树(25 point(s)) 给定一个插入序列就可以唯一确定一棵二叉搜索树.然而,一棵给定的二叉搜索树却可以由多种不同的插入序列得到.例如分别按照序列{2, 1, 3}和 ...
- leetcode 790. Domino and Tromino Tiling
We have two types of tiles: a 2x1 domino shape, and an "L" tromino shape. These shapes may ...
- python基础知识踩点
1.注释 在python中,注释是以任何存在于#右侧的文字,其主要作用是写给程序读者看的笔记. 例如 单行注释 >>print("hello world") #这是一个 ...
- css中IE判断语句 if !IE
1. <!–[if !IE]><!–> 除IE外都可识别 <!–<![endif]–> 2. <!–[if IE]> 所有的IE可识别 <! ...
- UVa 11572 唯一的雪花(优化策略)
题目描述: 输入一个长度为n(n<=1000000)的序列A, 找到一个尽量长的连续子序列A(L)-->A(R),是的该序列中没有相同的元素. 输入: T:代表组数 n:代表有n个数 这一 ...
- LightOJ1213 Fantasy of a Summation —— 快速幂
题目链接:https://vjudge.net/problem/LightOJ-1213 1213 - Fantasy of a Summation PDF (English) Statisti ...
- CodeForces - 86D D. Powerful array —— 莫队算法
题目链接:http://codeforces.com/problemset/problem/86/D D. Powerful array time limit per test 5 seconds m ...
- XML中CDATA和#PCDATA的区别
在XML文档中, 能看到“CDATA"的地方有三处: 1)在DTD中,指定标签中某个属性的类型为字符型时,使用CDATA.因为XML解析器会去分析这段字符内容,因而里面如果需要使用>, ...