Note_Master-Detail Application(iOS template)_07_ YJYDetailViewController.m

//  YJYDetailViewController.m

#import "YJYDetailViewController.h"

 

@interfaceYJYDetailViewController ()

@property (strong, nonatomic) UIPopoverController *masterPopoverController;

- (void)configureView;

@end

 

@implementation YJYDetailViewController

 

#pragma mark - Managing the detail item

 

- (void)setDetailItem:(id)newDetailItem

{

    if (_detailItem != newDetailItem) {

        _detailItem = newDetailItem;

        

        // Update the view.

        [selfconfigureView];

    }

 

    if (self.masterPopoverController != nil) {

        [self.masterPopoverControllerdismissPopoverAnimated:YES];

    }        

}

 

- (void)configureView

{

    // Update the user interface for the detail item.

 

    if (self.detailItem) {

        self.detailDescriptionLabel.text = [[self.detailItemvalueForKey:@"timeStamp"] description];

    }

}

 

- (void)viewDidLoad

{

    [superviewDidLoad];

// Do any additional setup after loading the view, typically from a nib.

    [selfconfigureView];

}

 

- (void)didReceiveMemoryWarning

{

    [superdidReceiveMemoryWarning];

    // Dispose of any resources that can be recreated.

}

 

#pragma mark - Split view

 

- (void)splitViewController:(UISplitViewController *)splitController willHideViewController:(UIViewController *)viewController withBarButtonItem:(UIBarButtonItem *)barButtonItem forPopoverController:(UIPopoverController *)popoverController

{

    barButtonItem.title = NSLocalizedString(@"Master", @"Master");

    [self.navigationItemsetLeftBarButtonItem:barButtonItem animated:YES];

    self.masterPopoverController = popoverController;

}

 

- (void)splitViewController:(UISplitViewController *)splitController willShowViewController:(UIViewController *)viewController invalidatingBarButtonItem:(UIBarButtonItem *)barButtonItem

{

    // Called when the view is shown again in the split view, invalidating the button and popover controller.

    // 隐藏导航栏左边的按钮

    [self.navigationItemsetLeftBarButtonItem:nilanimated:YES];

    self.masterPopoverController = nil;

}

 

@end

Note_Master-Detail Application(iOS template)_07_ YJYDetailViewController.m,,5-wow.com

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。