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,布布扣,bubuko.com

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

上一篇:Android学习笔记——多选按钮CheckBox


下一篇:ZT 安卓手机的安全性 prepare for Q