Self. TableView= [[UITableView alloc] Initwithframe:cgrectmake (0,0, self. View. Frame. Size. Width, self. View. Frame. Size. Height- -) Style:uitableviewstyleplain];[Self. ViewAddsubview:self. TableView];[_tableview release];Self. TableView. DataSource= Self;Self. TableView. Delegate= Self;Set cell row Height self. TableView. RowHeight= -;Self. ImageView= [[Uiimageview alloc] Initwithframe:cgrectmake (0, - $, self. View. Frame. Size. Width, $)];Self. ImageView. Image= [UIImage imagenamed:@"5.jpg"];Add a head view to TableView (do not move a picture)//width is the width of the TableView self. TableView. Tableheaderview= Self. ImageView;
Set the picture so that when you pull down, there will be no change.
You can try the following code effect!
- (void) Viewdidload {//Extra Small ads[ Self. TableViewAddsubview: Self. ImageView]; Self. TableView. Contentinset= Uiedgeinsetsmake ( $,0,0,0);}#pragma Mark TableView's delegate has signed the ScrollView agreement, as long as the agent is set up, you can use the ScrollView protocol method.- (void) Scrollviewdidscroll: (Uiscrollview*) scrollview{CGFloaty = ScrollView. Contentoffset. Y;if(Y <0) { Self. ImageView. Frame= CGRectMake (0Y Self. View. Frame. Size. Width,-y); }NSLog(@"%g", y);}
Of course, don't forget to write the method in the protocol.
TableView has a method reloaddata. You can refresh the data.
Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced.
Head view of UI TableView & "Small ads"