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;
}
最新文章
- (原创)解决.net 下使用uploadify,在火狐浏览器下的error 302
- Linux的概念与体系
- Android课程---优化ListView列表视图(2)
- jquery中ajax的简单使用
- 梳理一下JS的基本语法
- [水煮 ASP.NET Web API2 方法论](3-2)直接式路由/属性路由
- docker containerd 中的create 容器操作
- .net验证码生成及使用
- git 基础命令
- 【HDU4348】【主席树】To the moon
- 转自:Tsihang 三层网络设备对于IP报文的分片和重组处理原理
- UVa 11059 最大乘积
- 201521123031《java程序设计》第五周学习总结
- CentOS 7 安装 Jenkins
- android编码学习
- loadrunner笔记(二):飞机订票系统--客户信息注册
- 我的 $OI$, 退役前写点东西
- java 中如何声明线程安全的集合 set, map 和list【转】
- PHP: PCRE 函数- Manual
- AngularJS 模块及provide
热门文章
- CCBPM中的消息机制,CCIM服务端安装说明
- 记使用WaitGroup时的一个错误
- html的dtd声明
- 【BZOJ1528】[POI2005]sam-Toy Cars 贪心
- 20170313 ABAP程序未激活状态下保存或激活进入debug
- Android App 启动 Activity 创建解析
- iOS 打开应用与系统功能的调用
- [RK3288][Android6.0] 调试笔记 --- eMMC分区号和名字的对应【转】
- 自动化测试框架selenium+java+TestNG——配置篇
- SystemV和BSD的区别