[img]http://dl.iteye.com/upload/attachment/0077/7527/36d1c77e-8a45-30fe-a20f-c1935d2b7b9e.jpg[/img]
//解决问题的关键就下面的这段代码
这样就OK了
//解决问题的关键就下面的这段代码
UIView *headerView = [[UIView alloc] initWithFrame: CGRectMake(0, 0, 320, 44)];
self.tableView.tableHeaderView = headerView;
[headerView release];
//加了上面的代码之后tabview就向下移了44个像素,那刚好放上navbar
CGRect aScreenRect = [[UIScreen mainScreen] bounds];
//创建navbar
UINavigationBar *nav = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, aScreenRect.size.width, 44)];
//创建navbaritem
UINavigationItem *NavTitle = [[UINavigationItem alloc] initWithTitle:@"详细介绍"];
[nav pushNavigationItem:NavTitle animated:YES];
[self.view addSubview:nav];
//创建barbutton 创建系统样式的
UIBarButtonItem *item = [[UIBarButtonItem alloc]initWithBarButtonSystemItem:UIBarButtonSystemItemReply target:self action:@selector(navBackBt:)];
//设置barbutton
NavTitle.leftBarButtonItem = item;
[nav setItems:[NSArray arrayWithObject:NavTitle]];
[item release];
[NavTitle release];
[nav release];
这样就OK了