PageRenderTime 45ms CodeModel.GetById 15ms app.highlight 26ms RepoModel.GetById 1ms app.codeStats 0ms

/Mobile/iPhone/StoffiRemote/StoffiRemote/RemoteViewController.m

http://yet-another-music-application.googlecode.com/
Objective C | 91 lines | 58 code | 19 blank | 14 comment | 2 complexity | d4eb94746c43cd55e78b48f5fa30367b MD5 | raw file
 1//
 2//  RemoteViewController.m
 3//  StoffiRemote
 4//
 5//  Created by Fredrik Gadnell on 9/26/11.
 6//  Copyright 2011 __MyCompanyName__. All rights reserved.
 7//
 8
 9#import "RemoteViewController.h"
10#import "LoginViewController.h"
11#import "User.h"
12
13@implementation RemoteViewController
14
15- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
16{
17    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
18    if (self) {
19        // Custom initialization
20    }
21    return self;
22}
23
24- (IBAction)logoutPressed {
25    User *user = [User currentUser];
26    user = nil;
27    
28    [self presentLoginScreenAnimated:YES];
29}
30
31- (void)presentLoginScreenAnimated:(BOOL)animated {
32    LoginViewController *lvc = [[LoginViewController alloc] init];
33    lvc.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
34    [self presentModalViewController:lvc animated:animated];
35}
36
37- (void)dealloc
38{
39    [super dealloc];
40}
41
42- (void)didReceiveMemoryWarning
43{
44    // Releases the view if it doesn't have a superview.
45    [super didReceiveMemoryWarning];
46    
47    // Release any cached data, images, etc that aren't in use.
48}
49
50#pragma mark - Playback control
51
52- (void)playPressed {
53    playButton.hidden = YES;
54    pauseButton.hidden = NO;
55    
56    User *user = [User currentUser];
57    [user.configuration setProperty:PropertyMediaState toValue:[NSNumber numberWithInt:MediaStatePlaying]];
58    [user pushConfiguration];
59}
60
61- (void)pausePressed {
62    playButton.hidden = NO;
63    pauseButton.hidden = YES;
64    
65    User *user = [User currentUser];
66    [user.configuration setProperty:PropertyMediaState toValue:[NSNumber numberWithInt:MediaStatePaused]];
67    [user pushConfiguration];
68}
69
70#pragma mark - View lifecycle
71
72- (void)viewDidLoad
73{
74    [super viewDidLoad];
75    // Do any additional setup after loading the view from its nib.
76}
77
78- (void)viewDidUnload
79{
80    [super viewDidUnload];
81    // Release any retained subviews of the main view.
82    // e.g. self.myOutlet = nil;
83}
84
85- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
86{
87    // Return YES for supported orientations
88    return (interfaceOrientation == UIInterfaceOrientationPortrait);
89}
90
91@end