The code is illustrated by TableView, which is also applicable in other cases
-(void) viewdidload {[Super viewdidload]; _imageview = [[Uiimageview alloc]init]; _imageview.image = [UIImage imagenamed:@ "f2.jpg"]; Self.imageview.frame =cgrectmake (0, -150, Self.tableView.frame.size.width, 150); This cannot be done by adding headerview, because adding Headerview can only set the view's high [Self.tableview Addsubview:_imageview]; Self.tableView.contentInset = Uiedgeinsetsmake (150, 0, 0, 0); }-(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (nsinteger) section{return 100;} -(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) indexpath{ UITableViewCell * cell = [[UITableViewCell alloc]initwithstyle:uitableviewcellstylesubtitle ReuseIdentifier:nil]; Cell.textLabel.text = @ "I am the cell"; return cell;} -(void) didreceivememorywarning {[Super didreceivememorywarning]; Dispose of any resources the can be recreated.} -(void) Scrollviewdidscroll: (Uiscrollview *) scrollview{//re-set the size of the picture by sliding the cheap distance cgfloat yoffset = ScrollVIew.contentoffset.y; if (yoffset<-150) {cgrect f= self.imageview.frame; F.origin.y= Yoffset; F.size.height =-yoffset; Self.imageview.frame = f; }}
IOS----Achieve ScrollView or ScrollView sub-class drop-down image magnification effect