1、class.m文件
不要忘记添加<UITableViewDelegate,UITableViewDataSource>
- (void)viewDidLoad
{
[superviewDidLoad];
UIToolbar *tempToolbar = [[UIToolbar alloc]initWithFrame:CGRectMake(0,20, 320,44)];
self.toolbar = tempToolbar;
[tempToolbar release];
[self.viewaddSubview:self.toolbar];
UIBarButtonItem *bookshelf = [[UIBarButtonItemalloc] initWithTitle:@"shujia"style:UIBarButtonItemStyleBorderedtarget:nilaction:nil];
NSArray *barItems = [NSArray arrayWithObjects:bookshelf,nil];
[bookshelf release];
self.toolbar.items = barItems;
UITableView *tempTableview = [[UITableViewalloc] initWithFrame:CGRectMake(0,64, 320, 416)];
self.tableview = tempTableview;
[tempTableview release];
self.tableview.delegate =self;
self.tableview.dataSource =self;
[self.viewaddSubview:self.tableview];
Classes1 = [[NSArrayalloc] initWithObjects:@"一年级",@"二年级",@"三年级",@"四年级",@"五年级",@"六年级",@"七年级",@"八年级",@"九年级",nil];
// Do any additional setup after loading the view from its nib.
}
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
bookStore = [[Book alloc]init];
[self.windowaddSubview:book.view];
[self.windowmakeKeyAndVisible];
returnYES;
}