// // MainViewController.m // Taschenlampe // // Created by Chad Armstrong on 3/30/09. // Copyright Edenwaith 2009. All rights reserved. // #import "MainViewController.h" #import "MainView.h" @implementation MainViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]) { // Custom initialization } return self; } - (void) updateBackgroundColor { NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults]; if ([defaults objectForKey: @"red"] != nil) { red = [defaults floatForKey: @"red"]; } else { red = 0.5; } if ([defaults objectForKey: @"green"] != nil) { green = [defaults floatForKey: @"green"]; } else { green = 0.5; } if ([defaults objectForKey: @"blue"] != nil) { blue = [defaults floatForKey: @"blue"]; } else { blue = 0.5; } self.view.backgroundColor = [UIColor colorWithRed: red green: green blue: blue alpha: 1.0f]; } - (void ) viewDidAppear: (BOOL) animated { [self updateBackgroundColor]; [super viewDidAppear: animated]; } // If you need to do additional setup after loading the view, override viewDidLoad. - (void)viewDidLoad { [self updateBackgroundColor]; } - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { // Return YES for supported orientations return (interfaceOrientation == UIInterfaceOrientationPortrait); } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Releases the view if it doesn't have a superview // Release anything that's not essential, such as cached data } - (void)dealloc { [super dealloc]; } @end