objective-c编程,(prepareForSegue)

时间:2013-11-18 12:01:31

标签: objective-c

我尝试创建一个iOS应用程序,现在我是堆栈,我有一个类book,一个bookdetailcontroller,一个simplebookmanager,现在一切正常我正在设计,我已经成功显示所有书籍的名单,现在我尝试点击一个标题并显示有关书籍细节的其他视图,当我点击详细视图显示但没有显示任何信息时,它是空的!我在这里展示了我的代码:

这是

的一部分
//
//  SummaryMasterViewController.m
//  Design
//
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
{

    if ([[segue identifier] isEqualToString:@"showDetail"]) {

        SummaryDetailViewController *detailViewController = (SummaryDetailViewController *) [segue destinationViewController];
        NSIndexPath *indexPath = [self.tableView indexPathForSelectedRow];
        detailViewController.book =[self.bookManager bookAtIndex: indexPath.row];
}


//
//  SummaryDetailViewController.h
//  Design

#import <UIKit/UIKit.h>
#import "BookManagerProtocol.h"
#import "Book.h"
#import "SimpleBookManager.h"
#import "BookDetailViewController.h"

@interface SummaryDetailViewController : UIViewController <UISplitViewControllerDelegate>

@property (strong, nonatomic) id detailItem;

@property (weak, nonatomic) IBOutlet UILabel *detailDescriptionLabel;
@property Book *book;
@property BookDetailViewController *bookDetail;

@end

SummaryDetailViewController.m:

- (void)splitViewController:(UISplitViewController *)splitController `willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController`
{
    barButtonItem.title = NSLocalizedString(@"Master", @"Master");
    [self.navigationItem setLeftBarButtonItem:barButtonItem animated:YES];
    self.masterPopoverController = popoverController;
}

0 个答案:

没有答案