#import "HMViewController.h"

const CGFloat ICITopViewH = ;

@interface HMViewController ()
@property (nonatomic, weak) UIImageView *topView;
@end @implementation HMViewController - (void)viewDidLoad
{
[super viewDidLoad]; // 设置内边距(让cell往下移动一段距离)
self.tableView.contentInset = UIEdgeInsetsMake(ICITopViewH * 0.5, , , ); UIImageView *topView = [[UIImageView alloc] init];
topView.image = [UIImage imageNamed:@"biaoqingdi"];
topView.frame = CGRectMake(, -ICITopViewH, , ICITopViewH);
//设置UUIImageView的内容显示模式。来实现下拉放大的关键
topView.contentMode = UIViewContentModeScaleAspectFill;
//插入到tableView的第一个子控件,使用addSubView的话,下拉会把底部的Cell遮挡。
[self.tableView insertSubview:topView atIndex:];
self.topView = topView;
} #pragma mark - 数据源方法
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return ;
} - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *ID = @"cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:ID];
if (!cell) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:ID];
} cell.textLabel.text = [NSString stringWithFormat:@"测试数据---%ld", (long)indexPath.row]; return cell;
} - (void)scrollViewDidScroll:(UIScrollView *)scrollView
{
// 向下拽了多少距离
CGFloat down = -(ICITopViewH * 0.5) - scrollView.contentOffset.y;
if (down < ) return; CGRect frame = self.topView.frame;
// 5决定图片变大的速度,值越大,速度越快
frame.size.height = ICITopViewH + down * ;
self.topView.frame = frame;
} @end

最新文章

  1. druid连接池获取不到连接的一种情况
  2. Filco minila 的蛋疼。
  3. java.sql.date与java.util.date区别以及数据库中插入带时分秒的时间
  4. 省市区(县)三级联动代码(js 数据源)
  5. Java MongoDB Driver 3.x - Quick Start
  6. Spring基于注解的Cache支持
  7. mongoose CastError: Cast to ObjectId failed for value
  8. Scala学习笔记--Akka
  9. Centos系统mysql 忘记root用户的密码:
  10. [POJ1028]Web Navigation(栈)
  11. Get started with Google Analytics
  12. STM32F4中USB与PC双向通信
  13. window下的nginx的安装和使用
  14. DELL H730P写策略write-through和write-back配置说明
  15. install MariaDB 10.2 on Ubuntu 18
  16. 在虚拟机安装windows xp时所需要的序列号
  17. leetcode400
  18. 「caffe编译bug」 undefined reference to `boost::match_results&lt;__gnu_cxx::__normal_iterator&lt;char const*, std::__cxx11
  19. FOJ 1402(dp推规律)
  20. 使用反射实现 webdriver page 类

热门文章

  1. java计算两个日期之间相隔的月份(向下取整)
  2. 【cs231n】神经网络笔记笔记2
  3. SpringBoot中使用log4j日志
  4. 跟着vamei复习概率论
  5. LA 5846 霓虹灯广告牌(单色三角形问题)
  6. POJ 1144 Network(无向图的割顶和桥模板题)
  7. 如何查看一个进程打开哪些fd及对应的文件或套接字操作
  8. Warsaw U Contest Petrozavo dsk Summer 2011 Training Camp, Monday, September 5, 2011
  9. 实用SQL语句
  10. Android6.0------权限申请~easypermissions