iOS滑动tableView来改变导航栏的颜色
来源:互联网 发布:java poi读取excel文件 编辑:程序博客网 时间:2024/05/17 07:41
- (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;
}
[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;
}
0 0
- iOS滑动tableView来改变导航栏的颜色
- iOS滑动tableView来改变导航栏的颜色
- iOS滑动tableView来改变导航栏的颜色
- iOS 上下滑动tableView导航透明度逐渐改变
- 改变导航栏的颜色
- 改变导航栏的颜色
- <iOS>动态改变导航栏颜色
- IOS改变导航栏标题颜色
- Android 滑动改变标题/栏导航栏颜色、透明度
- Android滑动ScrollView时使导航栏停留的效果(仿ios的tableview分区)
- ios:改变tableview的titleForHeaderInSection字体颜色设置
- iOS tableView 改变头视图和脚视图的颜色
- ios改变导航栏颜色及其字体颜色
- 改变导航栏颜色
- iOS的导航栏颜色
- iOS 自定义分区头加上图片 以及导航控制器 颜色随滑动改变
- IOS tableView滑动设置导航栏透明度渐变 类似QQ空间导航栏渐变
- IOS 滑动tableview,导航栏渐渐显示,搜索框显示在导航栏上
- android ndk curl
- 映美精黑白相机在linux平台上的使用(一)
- 开始在linux下做c语言开发
- c语言 timer
- JavaScript 对象
- iOS滑动tableView来改变导航栏的颜色
- SIGPIPE信号--解决Linux socket中接收端退出导致发送端send退出问题
- OCP-1Z0-051-2015-13题
- ptp与ntp时间戳专题讲解
- HTML初步
- linux环境变量设置方法总结(PATH/LD_LIBRARY_PATH)
- express 与 http 的区别
- QQ协议分析(一)
- RMAN主要命令 show,list,crosscheck,delete详解