source: trunk/sync_main.mm @ 26

Revision 26, 2.7 KB checked in by kpoole, 2 years ago (diff)

Episode 5

Line 
1//
2//  sync_main.mm
3//  wesnoth
4//
5//  Created by Kyle Poole on 5/10/10.
6//  Copyright 2010 __MyCompanyName__. All rights reserved.
7//
8
9#import "sync_main.h"
10#import "sync_upload.h"
11#import "sync_download.h"
12
13@implementation sync_main
14
15extern UIView *gLandscapeView;
16extern bool gPauseForOpenFeint;
17sync_upload *syncUploadViewController;
18sync_download *syncDownloadViewController;
19
20
21/*
22 // The designated initializer.  Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
23- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
24    if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
25        // Custom initialization
26    }
27    return self;
28}
29*/
30
31/*
32// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
33- (void)viewDidLoad {
34    [super viewDidLoad];
35}
36*/
37
38/*
39// Override to allow orientations other than the default portrait orientation.
40- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
41    // Return YES for supported orientations
42    return (interfaceOrientation == UIInterfaceOrientationPortrait);
43}
44*/
45
46- (void)didReceiveMemoryWarning {
47    // Releases the view if it doesn't have a superview.
48    [super didReceiveMemoryWarning];
49   
50    // Release any cached data, images, etc that aren't in use.
51}
52
53- (void)viewDidUnload {
54    [super viewDidUnload];
55    // Release any retained subviews of the main view.
56    // e.g. self.myOutlet = nil;
57}
58
59
60- (void)dealloc {
61    [super dealloc];
62}
63
64-(IBAction)onUpload:(id)sender
65{
66    [self.view removeFromSuperview];
67   
68    syncUploadViewController = [[sync_upload alloc] initWithNibName:@"sync_upload" bundle:nil];
69   
70    CGRect frameRect = syncUploadViewController.view.frame;
71#ifdef __IPAD__
72    frameRect.origin.x = (1024-480)/2;
73    frameRect.origin.y = (768-320)/2;
74#else
75    frameRect.origin.x = 0;
76    frameRect.origin.y = 0;
77#endif
78    syncUploadViewController.view.frame = frameRect;
79    [gLandscapeView addSubview:syncUploadViewController.view]; 
80}
81
82-(IBAction)onDownload:(id)sender
83{
84    [self.view removeFromSuperview];
85   
86    syncDownloadViewController = [[sync_download alloc] initWithNibName:@"sync_download" bundle:nil];
87   
88    CGRect frameRect = syncDownloadViewController.view.frame;
89#ifdef __IPAD__
90    frameRect.origin.x = (1024-480)/2;
91    frameRect.origin.y = (768-320)/2;
92#else
93    frameRect.origin.x = 0;
94    frameRect.origin.y = 0;
95#endif
96    syncDownloadViewController.view.frame = frameRect;
97    [gLandscapeView addSubview:syncDownloadViewController.view];   
98}
99
100-(IBAction)onDone:(id)sender
101{
102    [self.view removeFromSuperview];
103    gLandscapeView.hidden = YES;
104    gPauseForOpenFeint = false;
105}
106
107
108@end
Note: See TracBrowser for help on using the repository browser.