// 头文件
//
// GroupTableViewController.h
// UITableViewGroup
//
// Created by LiZe on 13-9-5.
// Copyright (c) 2013年BlackCode. All rights reserved.
//
#import
#import"DetailViewController.h"
@interface GroupTableViewController : UIViewController<</span>UITableViewDelegate,UITableViewDataSource>
@property (nonatomic,retain) UITableView *groupTableView;
@end
// 实现文件
//
// GroupTableViewController.m
// UITableViewGroup
//
// Created by LiZe on 13-9-5.
// Copyright (c) 2013年BlackCode. All rights reserved.
//
#import"GroupTableViewController.h"
@interfaceGroupTableViewController ()
@end
@implementationGroupTableViewController
-(id)initWithNibName:(NSString *)nibNameOrNilbundle:(NSBundle*)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custominitialization
}
return self;
}
-(void)viewDidLoad
{
[superviewDidLoad];
// Do any additional setup after loading the view.
// 设置标题
self.title= @"UITableView Group的使用";
// 初始化groupTableView
self.groupTableView = [[[UITableView alloc] initWithFrame:CGRectMake(0,0, self.view.frame.size.width,self.view.frame.size.height)style:UITableViewStyleGrouped] autorelease];
//设置表示图的数据源委托
_groupTableView.dataSource = self;
// 设置表示图的委托
_groupTableView.delegate = self;
// 设置groupTableView的背景颜色
UIView *groupTableViewBGView =[[UIView alloc] initWithFrame:self.view.frame];
groupTableViewBGView.backgroundColor = [UIColor brownColor