AdvancedTableSearch/APLDetailViewController.m

/*
 Copyright (C) 2013-2014 Apple Inc. All Rights Reserved.
 See LICENSE.txt for this sample’s licensing information
 
 Abstract:
 Detail view controller for the application. Implemented to support state restoration.
 */
 
#import "APLDetailViewController.h"
 
@interface APLDetailViewController ()
@property (nonatomic, strong) IBOutlet UILabel *productInfoLabel;
@end
 
@implementation APLDetailViewController
 
static NSString *ProductTitleKey = @"ProductTitleKey";
static NSString *ProductInfoKey = @"ProductInfoKey";
 
- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
 
    self.navigationController.navigationBar.translucent = NO;
 
    self.productInfoLabel.text = self.productInfo;
}
 
- (void)encodeRestorableStateWithCoder:(NSCoder *)coder
{
    [super encodeRestorableStateWithCoder:coder];
 
    [coder encodeObject:self.title forKey:ProductTitleKey];
    [coder encodeObject:self.productInfoLabel.text forKey:ProductInfoKey];
}
 
- (void)decodeRestorableStateWithCoder:(NSCoder *)coder
{
    [super decodeRestorableStateWithCoder:coder];
 
    self.title = [coder decodeObjectForKey:ProductTitleKey];
    self.productInfo = [coder decodeObjectForKey:ProductInfoKey];
}
 
@end