Using layout subviews instead of will appear

This commit is contained in:
Kyle Fang
2015-07-07 11:40:53 +08:00
parent 86fc24816b
commit 099450f394

View File

@@ -26,12 +26,12 @@ static CGFloat kImageOriginHight = 240.f;
[self.tableView addSubview:self.expandZoomImageView]; [self.tableView addSubview:self.expandZoomImageView];
} }
- (void)viewWillAppear:(BOOL)animated{ - (void)viewWillLayoutSubviews {
[super viewWillAppear:animated]; [super viewWillLayoutSubviews];
self.expandZoomImageView.frame = CGRectMake(0, -kImageOriginHight, self.tableView.frame.size.width, kImageOriginHight); self.expandZoomImageView.frame = CGRectMake(0, -kImageOriginHight, self.tableView.frame.size.width, kImageOriginHight);
} }
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{ - (void)scrollViewDidScroll:(UIScrollView *)scrollView{
CGFloat yOffset = scrollView.contentOffset.y; CGFloat yOffset = scrollView.contentOffset.y;
if (yOffset < -kImageOriginHight) { if (yOffset < -kImageOriginHight) {