-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAssosTVC.m
More file actions
291 lines (243 loc) · 9.52 KB
/
AssosTVC.m
File metadata and controls
291 lines (243 loc) · 9.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
//
// AssosTVC.m
// iMines-1
//
// Created by François de la Taste on 31/08/10.
/*
This file is part of iMines ParisTech.
iMines ParisTech is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
iMines ParisTech is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#import "AssosTVC.h"
#import "HTMLViewController.h"
@implementation AssosTVC
#pragma mark -
#pragma mark View lifecycle
- (void)viewDidLoad {
[super viewDidLoad];
arrayAssos = [[NSMutableArray alloc] init];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"Bureau des Elèves", @"title",
@"presentation_BDE", @"htmlfilename",
@"logo_bde.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"Forum Trium", @"title",
@"Forum-Trium", @"htmlfilename",
@"logo_trium.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"JuMP", @"title",
@"article_jump", @"htmlfilename",
@"icon_jump.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"ASTI", @"title",
@"article_asti", @"htmlfilename",
@"icon_asti.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"BDS", @"title",
@"Article_BDS", @"htmlfilename",
@"icon_BDS.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"BDA", @"title",
@"Article_BDA", @"htmlfilename",
@"icon_BDA.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"MediaMines", @"title",
@"article_mediamines", @"htmlfilename",
@"icon_MediaMines.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"Zánbinou", @"title",
@"Article_zambinou", @"htmlfilename",
@"icon_zambinou.jpg", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"MoRU", @"title",
@"Article_Moru", @"htmlfilename",
@"icon_moru.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"MineShake", @"title",
@"Article_MineShake", @"htmlfilename",
@"icon_MineShake.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"Kâlimat", @"title",
@"Article_kalimat", @"htmlfilename",
@"icon_kalimat.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"CERes", @"title",
@"Article_CERES", @"htmlfilename",
@"icon_ceres.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"Biéro", @"title",
@"article_biero", @"htmlfilename",
@"icone_biero.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"RIVOTRA", @"title",
@"article_rivotra", @"htmlfilename",
@"icon_rivotra.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"Ski Club", @"title",
@"article_skiclub", @"htmlfilename",
@"icon_skiclub.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"Cté Chrétienne", @"title",
@"laCC", @"htmlfilename",
@"icon_CC.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"CAV", @"title",
@"article_cav", @"htmlfilename",
@"icon_cav.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"Club Thé", @"title",
@"article_clubthe", @"htmlfilename",
@"icon_clubthe.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"Club Chocolat", @"title",
@"club-chocolat", @"htmlfilename",
@"icon_clubchocolat.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"Club PT", @"title",
@"club-pt", @"htmlfilename",
@"icon_clubPT.png", @"icon",
nil]];
[arrayAssos addObject:[NSDictionary dictionaryWithObjectsAndKeys:
@"Cap sur le Phare Ouest", @"title",
@"article_phareouest", @"htmlfilename",
@"", @"icon",
nil]];
// Redéfinition du bouton Retour pour une meilleure lisibilité (plus court)
UIBarButtonItem *backButton = [[UIBarButtonItem alloc] initWithTitle:@"Assos" style:UIBarButtonItemStyleBordered target:self action:nil];
self.navigationItem.backBarButtonItem = backButton;
[backButton release];
// Uncomment the following line to display an Edit button in the navigation bar for this view controller.
// self.navigationItem.rightBarButtonItem = self.editButtonItem;
}
/*
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
}
*/
/*
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
}
*/
/*
- (void)viewWillDisappear:(BOOL)animated {
[super viewWillDisappear:animated];
}
*/
/*
- (void)viewDidDisappear:(BOOL)animated {
[super viewDidDisappear:animated];
}
*/
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
#pragma mark -
#pragma mark Table view data source
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
// Return the number of rows in the section.
return [arrayAssos count];
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *CellIdentifier = @"Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
cell.textLabel.text = [[arrayAssos objectAtIndex:indexPath.row] objectForKey:@"title"];
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
cell.imageView.image = [UIImage imageNamed:[[arrayAssos objectAtIndex:indexPath.row] objectForKey:@"icon"]];
return cell;
}
/*
// Override to support conditional editing of the table view.
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the specified item to be editable.
return YES;
}
*/
/*
// Override to support editing the table view.
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
if (editingStyle == UITableViewCellEditingStyleDelete) {
// Delete the row from the data source
[tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
}
else if (editingStyle == UITableViewCellEditingStyleInsert) {
// Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
}
}
*/
/*
// Override to support rearranging the table view.
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
}
*/
/*
// Override to support conditional rearranging of the table view.
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
// Return NO if you do not want the item to be re-orderable.
return YES;
}
*/
#pragma mark -
#pragma mark Table view delegate
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here. Create and push another view controller.
HTMLViewController *detailViewController = [[HTMLViewController alloc] initWithHTMLfilename:[[arrayAssos objectAtIndex:indexPath.row] objectForKey:@"htmlfilename"]];
detailViewController.title = [[arrayAssos objectAtIndex:indexPath.row] objectForKey:@"title"];
// Pass the selected object to the new view controller.
[self.navigationController pushViewController:detailViewController animated:YES];
[detailViewController release];
}
#pragma mark -
#pragma mark Memory management
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Relinquish ownership any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
// Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
// For example: self.myOutlet = nil;
}
- (void)dealloc {
[super dealloc];
}
@end