jackyshan

导航

 

a - (void)viewDidLoad

    {
     
      
     [super viewDidLoad];
                 
        self.tableView.contentInset = UIEdgeInsetsMake(kImageOriginHight, 0, 0, 0);
        [self.tableView addSubview:self.expandZoomImageView];
    }

    - (void)viewWillAppear:(BOOL)animated{
        [super viewWillAppear:animated];
        
        self.expandZoomImageView.frame = CGRectMake(0, -kImageOriginHight, self.tableView.frame.size.width, kImageOriginHight);
    }

    - (void)scrollViewDidScroll:(UIScrollView *)scrollView{
        CGFloat yOffset  = scrollView.contentOffset.y;
        if (yOffset < -kImageOriginHight) {
            CGRect f = self.expandZoomImageView.frame;
            f.origin.y = yOffset;
            CGFloat factor = ((fabs(yOffset)+kImageOriginHight)*self.view.frame.size.width)/kImageOriginHight;
            f.origin.x = -(factor/2-self.view.frame.size.width)/2;
            f.size.width = factor/2;
            f.size.height = (kImageOriginHight+fabs(yOffset))/2;
            self.expandZoomImageView.frame = f;
        }
    }
posted on 2016-08-07 17:50  jackyshan  阅读(214)  评论(0编辑  收藏  举报