VLCMovieViewController.m 2.46 KB
Newer Older
Felix Paul Kühne's avatar
Felix Paul Kühne committed
1
//
2
//  VLCMovieViewController.m
Felix Paul Kühne's avatar
Felix Paul Kühne committed
3 4 5 6 7 8
//  AspenProject
//
//  Created by Felix Paul Kühne on 27.02.13.
//  Copyright (c) 2013 VideoLAN. All rights reserved.
//

9
#import "VLCMovieViewController.h"
Felix Paul Kühne's avatar
Felix Paul Kühne committed
10

11
@interface VLCMovieViewController ()
Felix Paul Kühne's avatar
Felix Paul Kühne committed
12 13 14 15
@property (strong, nonatomic) UIPopoverController *masterPopoverController;
- (void)configureView;
@end

16
@implementation VLCMovieViewController
Felix Paul Kühne's avatar
Felix Paul Kühne committed
17 18 19

- (void)dealloc
{
20
    [_mediaItem release];
Felix Paul Kühne's avatar
Felix Paul Kühne committed
21 22 23 24 25
    [_detailDescriptionLabel release];
    [_masterPopoverController release];
    [super dealloc];
}

26
#pragma mark - Managing the media item
Felix Paul Kühne's avatar
Felix Paul Kühne committed
27

28
- (void)setMediaItem:(id)newMediaItem
Felix Paul Kühne's avatar
Felix Paul Kühne committed
29
{
30 31 32
    if (_mediaItem != newMediaItem) {
        [_mediaItem release];
        _mediaItem = [newMediaItem retain];
Felix Paul Kühne's avatar
Felix Paul Kühne committed
33 34 35 36 37 38 39

        // Update the view.
        [self configureView];
    }

    if (self.masterPopoverController != nil) {
        [self.masterPopoverController dismissPopoverAnimated:YES];
40
    }
Felix Paul Kühne's avatar
Felix Paul Kühne committed
41 42 43 44
}

- (void)configureView
{
45
    // Update the user interface for the media item.
Felix Paul Kühne's avatar
Felix Paul Kühne committed
46

47 48 49
    if (self.mediaItem) {
        self.detailDescriptionLabel.text = [self.mediaItem title];
        self.title = [self.mediaItem title];
Felix Paul Kühne's avatar
Felix Paul Kühne committed
50 51 52 53 54 55
    }
}

- (void)viewDidLoad
{
    [super viewDidLoad];
56
    // Do any additional setup after loading the view, typically from a nib.
Felix Paul Kühne's avatar
Felix Paul Kühne committed
57 58 59 60 61 62 63 64 65 66 67 68 69
    [self configureView];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
70
        self.title = @"Video Playback";
Felix Paul Kühne's avatar
Felix Paul Kühne committed
71 72 73
    }
    return self;
}
74

Felix Paul Kühne's avatar
Felix Paul Kühne committed
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91
#pragma mark - Split view

- (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;
}

- (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.navigationItem setLeftBarButtonItem:nil animated:YES];
    self.masterPopoverController = nil;
}

@end