//
//  InfoViewController.m
//  VisIVOSmart
//
//  Created by Fabio Vitello on 18/10/11.
//  Copyright (c) 2011 nothing. All rights reserved.
//

#import "InfoViewController.h"

@implementation InfoViewController

- (id)init
{
    self = [super init];
    if (self) {
        infoView = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        
        NSLog(@"inizializzo");
    }
    return self;
}

- (void)didReceiveMemoryWarning
{
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc that aren't in use.
}

#pragma mark - View lifecycle

// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView
{
    
    NSLog(@"load1");
    [infoView setBackgroundColor:[UIColor greenColor]];
    
    NSLog(@"load2");

    
    UILabel *lbl=[[UILabel alloc]initWithFrame:CGRectMake(30, 10, 100, 100)];
    lbl.text=@"lbl di prova";
    
    [infoView addSubview:lbl];
    [lbl release];
    
    UIButton *returnButton= [UIButton buttonWithType:UIButtonTypeInfoDark];

    
    [infoView addSubview:returnButton];
    
    
    //[returnButton addTarget:self action:@selector(returnView) forControlEvents:UIControlEventTouchUpInside];
    
    
  //[infoView addSubview:returnButton];
    NSLog(@"load3");
  

   	
    [self setView:infoView];
    [infoView release];
    
}

-(void)returnView
{
    
    [UIView beginAnimations:nil context:nil];
	[UIView setAnimationDuration:1.0];
	[UIView setAnimationTransition:UIViewAnimationTransitionFlipFromLeft
						   forView:[self view]
							 cache:YES];
	[self.view removeFromSuperview];
	[UIView commitAnimations];
}

/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad
{
    [super viewDidLoad];
}
*/

- (void)viewDidUnload
{
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    // Return YES for supported orientations
    return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

@end
