Plain style area head suspension display; grouped style area head follow table slide
Code:
#import "ViewController.h"
@interface Viewcontroller () <UITableViewDelegate,UITableViewDataSource>
@property (Nonatomic,strong) UITableView *tab;
@end
@implementation Viewcontroller
-(void) Viewdidload {
[Superviewdidload];
Do no additional setup after loading the view, typically from a nib.
UITableView *tab = [[Uitableviewalloc]initwithframe:self.view.boundsstyle:uitableviewstyleplain];
[Self.viewaddSubview:tab];
Tab.delegate =self;
Tab.datasource =self;
[Tab registerclass:[uitableviewcellclass]forcellreuseidentifier:@ "Cell"];
self.tab = tab;
}
-(Nsinteger) Numberofsectionsintableview: (UITableView *) tableview{
RETURN4;
}
-(Nsinteger) TableView: (UITableView *) TableView numberofrowsinsection: (Nsinteger) section{
RETURN10;
}
-(UITableViewCell *) TableView: (UITableView *) TableView Cellforrowatindexpath: (Nsindexpath *) indexPath{
UITableViewCell *cell = [tableviewdequeuereusablecellwithidentifier:@ "cell"];
Cell.textLabel.text = [nsstringstringwithformat:@ partition:%ld___ rows:%ld, Indexpath.section,indexpath.row];
return cell;
}
-(CGFloat) TableView: (UITableView *) TableView Heightforrowatindexpath: (Nsindexpath *) indexpath{
Return40;
}
-(CGFloat) TableView: (UITableView *) TableView heightforheaderinsection: (Nsinteger) section{
Return30;
}
-(UIView *) TableView: (UITableView *) TableView viewforheaderinsection: (Nsinteger) section{
UIView *aview = [[Uiviewalloc]initwithframe:cgrectmake (0,0, [uiscreenmainscreen].bounds.size.width,30]];
Aview.backgroundcolor = [Uicoloryellowcolor];
return aview;
}
-(void) didreceivememorywarning {
[Superdidreceivememorywarning];
Dispose of any of the can is recreated.
}
@end