它结和表视图和详细视图,而且还能调整内容的大小。 主要还能在ipad和iphone上面跑起来
不过在ipad上面用到是弹出层(竖屏)
2.在使用xcode 4.5,ios6时,一些基本重要的方法都自动生成,只需要你填入适当的数据即可
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{//在该方法中部分功能已实现 UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell" forIndexPath:indexPath]; cell.textLabel.text=@"title"// 你需要处理标题 还有付标题 以及image return cell; } //切换时调用方法也生成了,在该方法中可以设置在详细视图中显示的值 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
3.在DetailViewController中实现代码
- (void)configureView { // Update the user interface for the detail item. if (self.detailItem) { //self.detailDescriptionLabel.text = [self.detailItem description]; //你预在详细页面显示的内容 } }
4. 在MasterViewController里面 还增加两个默认的编辑按钮和删除按钮。
- (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view, typically from a nib. self.navigationItem.leftBarButtonItem = self.editButtonItem; UIBarButtonItem *addButton = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAdd target:self action:@selector(insertNewObject:)]; self.navigationItem.rightBarButtonItem = addButton; }