3250
|
1 |
//
|
|
2 |
// SingleTeamViewController.m
|
|
3 |
// HedgewarsMobile
|
|
4 |
//
|
|
5 |
// Created by Vittorio on 02/04/10.
|
|
6 |
// Copyright 2010 __MyCompanyName__. All rights reserved.
|
|
7 |
//
|
|
8 |
|
|
9 |
#import "SingleTeamViewController.h"
|
|
10 |
|
|
11 |
|
|
12 |
@implementation SingleTeamViewController
|
3251
|
13 |
@synthesize secondaryItems;
|
3250
|
14 |
|
|
15 |
|
|
16 |
#pragma mark -
|
|
17 |
#pragma mark View lifecycle
|
|
18 |
- (void)viewDidLoad {
|
|
19 |
[super viewDidLoad];
|
|
20 |
|
|
21 |
// Uncomment the following line to preserve selection between presentations.
|
|
22 |
self.clearsSelectionOnViewWillAppear = NO;
|
|
23 |
|
|
24 |
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
|
|
25 |
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
|
3251
|
26 |
|
|
27 |
NSMutableArray *array = [[NSMutableArray alloc] initWithObjects:
|
|
28 |
NSLocalizedString(@"Color",@""),
|
|
29 |
NSLocalizedString(@"Grave",@""),
|
|
30 |
NSLocalizedString(@"Voice",@""),
|
|
31 |
NSLocalizedString(@"Fort",@""),
|
|
32 |
NSLocalizedString(@"Flag",@""),
|
|
33 |
NSLocalizedString(@"Level",@""),nil];
|
|
34 |
self.secondaryItems = array;
|
|
35 |
[array release];
|
3250
|
36 |
}
|
3251
|
37 |
|
3250
|
38 |
|
|
39 |
/*
|
|
40 |
- (void)viewWillAppear:(BOOL)animated {
|
|
41 |
[super viewWillAppear:animated];
|
|
42 |
}
|
|
43 |
*/
|
|
44 |
/*
|
|
45 |
- (void)viewDidAppear:(BOOL)animated {
|
|
46 |
[super viewDidAppear:animated];
|
|
47 |
}
|
|
48 |
*/
|
|
49 |
/*
|
|
50 |
- (void)viewWillDisappear:(BOOL)animated {
|
|
51 |
[super viewWillDisappear:animated];
|
|
52 |
}
|
|
53 |
*/
|
|
54 |
/*
|
|
55 |
- (void)viewDidDisappear:(BOOL)animated {
|
|
56 |
[super viewDidDisappear:animated];
|
|
57 |
}
|
|
58 |
*/
|
|
59 |
|
|
60 |
|
3251
|
61 |
-(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
|
3250
|
62 |
// Override to allow orientations other than the default portrait orientation.
|
3251
|
63 |
return (interfaceOrientation == UIInterfaceOrientationLandscapeRight);
|
3250
|
64 |
}
|
|
65 |
|
|
66 |
|
|
67 |
#pragma mark -
|
|
68 |
#pragma mark Table view data source
|
|
69 |
|
|
70 |
-(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
|
|
71 |
// Return the number of sections.
|
|
72 |
return 3;
|
|
73 |
}
|
|
74 |
|
|
75 |
|
|
76 |
-(NSInteger) tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
|
|
77 |
// Return the number of rows in the section.
|
|
78 |
NSInteger rows;
|
|
79 |
switch (section) {
|
|
80 |
case 0:
|
|
81 |
rows = 1;
|
|
82 |
break;
|
|
83 |
case 1:
|
|
84 |
rows = 8;
|
|
85 |
break;
|
|
86 |
case 2:
|
3251
|
87 |
rows = 6;
|
3250
|
88 |
break;
|
|
89 |
default:
|
|
90 |
break;
|
|
91 |
}
|
|
92 |
return rows;
|
|
93 |
}
|
|
94 |
|
|
95 |
|
|
96 |
// Customize the appearance of table view cells.
|
3251
|
97 |
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
|
3250
|
98 |
|
|
99 |
static NSString *CellIdentifier = @"Cell";
|
|
100 |
|
|
101 |
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
|
|
102 |
if (cell == nil) {
|
|
103 |
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
|
|
104 |
}
|
|
105 |
|
3251
|
106 |
switch ([indexPath section]) {
|
|
107 |
case 2:
|
|
108 |
cell.textLabel.text = [self.secondaryItems objectAtIndex:[indexPath row]];
|
|
109 |
break;
|
|
110 |
default:
|
|
111 |
break;
|
|
112 |
}
|
3250
|
113 |
|
|
114 |
return cell;
|
|
115 |
}
|
|
116 |
|
|
117 |
|
|
118 |
/*
|
|
119 |
// Override to support conditional editing of the table view.
|
|
120 |
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
121 |
// Return NO if you do not want the specified item to be editable.
|
|
122 |
return YES;
|
|
123 |
}
|
|
124 |
*/
|
|
125 |
|
|
126 |
|
|
127 |
/*
|
|
128 |
// Override to support editing the table view.
|
|
129 |
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
130 |
|
|
131 |
if (editingStyle == UITableViewCellEditingStyleDelete) {
|
|
132 |
// Delete the row from the data source
|
|
133 |
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
|
|
134 |
}
|
|
135 |
else if (editingStyle == UITableViewCellEditingStyleInsert) {
|
|
136 |
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
|
|
137 |
}
|
|
138 |
}
|
|
139 |
*/
|
|
140 |
|
|
141 |
|
|
142 |
/*
|
|
143 |
// Override to support rearranging the table view.
|
|
144 |
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
|
|
145 |
}
|
|
146 |
*/
|
|
147 |
|
|
148 |
|
|
149 |
/*
|
|
150 |
// Override to support conditional rearranging of the table view.
|
|
151 |
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
|
|
152 |
// Return NO if you do not want the item to be re-orderable.
|
|
153 |
return YES;
|
|
154 |
}
|
|
155 |
*/
|
|
156 |
|
|
157 |
|
|
158 |
#pragma mark -
|
|
159 |
#pragma mark Table view delegate
|
|
160 |
|
3251
|
161 |
-(void) tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
|
3250
|
162 |
// Navigation logic may go here. Create and push another view controller.
|
|
163 |
/*
|
|
164 |
<#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
|
|
165 |
// ...
|
|
166 |
// Pass the selected object to the new view controller.
|
|
167 |
[self.navigationController pushViewController:detailViewController animated:YES];
|
|
168 |
[detailViewController release];
|
|
169 |
*/
|
|
170 |
}
|
|
171 |
|
|
172 |
|
|
173 |
#pragma mark -
|
|
174 |
#pragma mark Memory management
|
|
175 |
|
3251
|
176 |
-(void) didReceiveMemoryWarning {
|
3250
|
177 |
// Releases the view if it doesn't have a superview.
|
|
178 |
[super didReceiveMemoryWarning];
|
|
179 |
|
|
180 |
// Relinquish ownership any cached data, images, etc that aren't in use.
|
|
181 |
}
|
|
182 |
|
3251
|
183 |
-(void) viewDidUnload {
|
|
184 |
self.secondaryItems = nil;
|
3250
|
185 |
// Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
|
|
186 |
// For example: self.myOutlet = nil;
|
|
187 |
}
|
|
188 |
|
|
189 |
|
3251
|
190 |
-(void) dealloc {
|
|
191 |
[secondaryItems release];
|
3250
|
192 |
[super dealloc];
|
|
193 |
}
|
|
194 |
|
|
195 |
|
|
196 |
@end
|
|
197 |
|