project_files/HedgewarsMobile/Classes/MapConfigViewController.m
branchios-develop
changeset 12872 00215a7ec5f5
parent 11554 73e6a3d2f768
equal deleted inserted replaced
12871:2c06b1120749 12872:00215a7ec5f5
    28 @synthesize previewButton, maxHogs, seedCommand, templateFilterCommand, mapGenCommand, mazeSizeCommand, themeCommand, staticMapCommand,
    28 @synthesize previewButton, maxHogs, seedCommand, templateFilterCommand, mapGenCommand, mazeSizeCommand, themeCommand, staticMapCommand,
    29             missionCommand, tableView, maxLabel, segmentedControl, slider, lastIndexPath, dataSourceArray, busy,
    29             missionCommand, tableView, maxLabel, segmentedControl, slider, lastIndexPath, dataSourceArray, busy,
    30             oldPage, oldValue;
    30             oldPage, oldValue;
    31 
    31 
    32 
    32 
    33 -(BOOL) shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    33 - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    34     return rotationManager(interfaceOrientation);
    34     return rotationManager(interfaceOrientation);
    35 }
    35 }
    36 
    36 
    37 -(IBAction) mapButtonPressed:(id) sender {
    37 - (IBAction)mapButtonPressed:(id)sender {
    38     [[AudioManagerController mainManager] playClickSound];
    38     [[AudioManagerController mainManager] playClickSound];
    39     [self updatePreview];
    39     [self updatePreview];
    40 }
    40 }
    41 
    41 
    42 -(void) updatePreview {
    42 - (void)updatePreview {
    43     // don't generate a new preview while it's already generating one
    43     // don't generate a new preview while it's already generating one
    44     if (self.busy)
    44     if (self.busy)
    45         return;
    45         return;
    46 
    46 
    47     // generate a seed
    47     // generate a seed
    48     NSString *seed = [HWUtils seed];
    48     NSString *seed = [HWUtils seed];
    49     NSString *seedCmd = [[NSString alloc] initWithFormat:@"eseed {%@}", seed];
    49     NSString *seedCmd = [[NSString alloc] initWithFormat:@"eseed {%@}", seed];
    50     self.seedCommand = seedCmd;
    50     self.seedCommand = seedCmd;
    51     [seedCmd release];
       
    52 
    51 
    53     NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
    52     NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
    54     if (isRandomness()) {
    53     if (isRandomness()) {
    55         // prevent other events and add an activity while the preview is beign generated
    54         // prevent other events and add an activity while the preview is beign generated
    56         [self turnOffWidgets];
    55         [self turnOffWidgets];
    57         [self.previewButton updatePreviewWithSeed:seed];
    56         [self.previewButton updatePreviewWithSeed:seed];
    58         // the preview for static maps is loaded in didSelectRowAtIndexPath
    57         // the preview for static maps is loaded in didSelectRowAtIndexPath
    59     }
    58     }
    60     [seed release];
       
    61 
    59 
    62     // perform as if user clicked on an entry
    60     // perform as if user clicked on an entry
    63     NSIndexPath *theIndex = [NSIndexPath indexPathForRow:arc4random_uniform((int)[source count]) inSection:0];
    61     NSIndexPath *theIndex = [NSIndexPath indexPathForRow:arc4random_uniform((int)[source count]) inSection:0];
    64     [self tableView:self.tableView didSelectRowAtIndexPath:theIndex];
    62     [self tableView:self.tableView didSelectRowAtIndexPath:theIndex];
    65     if (IS_NOT_POWERFUL([HWUtils modelType]) == NO)
    63     if (IS_NOT_POWERFUL([HWUtils modelType]) == NO)
    66         [self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
    64         [self.tableView scrollToRowAtIndexPath:theIndex atScrollPosition:UITableViewScrollPositionMiddle animated:YES];
    67 }
    65 }
    68 
    66 
    69 -(void) turnOffWidgets {
    67 - (void)turnOffWidgets {
    70     busy = YES;
    68     busy = YES;
    71     self.previewButton.alpha = 0.5f;
    69     self.previewButton.alpha = 0.5f;
    72     self.previewButton.enabled = NO;
    70     self.previewButton.enabled = NO;
    73     self.maxLabel.text = NSLocalizedString(@"Loading...",@"");;
    71     self.maxLabel.text = NSLocalizedString(@"Loading...",@"");;
    74     self.segmentedControl.enabled = NO;
    72     self.segmentedControl.enabled = NO;
    75     self.slider.enabled = NO;
    73     self.slider.enabled = NO;
    76 }
    74 }
    77 
    75 
    78 #pragma mark -
    76 #pragma mark -
    79 #pragma mark MapPreviewButtonView delegate methods
    77 #pragma mark MapPreviewButtonView delegate methods
    80 -(void) turnOnWidgets {
    78 - (void)turnOnWidgets {
    81     self.previewButton.alpha = 1.0f;
    79     self.previewButton.alpha = 1.0f;
    82     self.previewButton.enabled = YES;
    80     self.previewButton.enabled = YES;
    83     self.segmentedControl.enabled = YES;
    81     self.segmentedControl.enabled = YES;
    84     self.slider.enabled = YES;
    82     self.slider.enabled = YES;
    85     self.busy = NO;
    83     self.busy = NO;
    86 }
    84 }
    87 
    85 
    88 -(void) setMaxLabelText:(NSString *)str {
    86 - (void)setMaxLabelText:(NSString *)str {
    89     self.maxHogs = [str intValue];
    87     self.maxHogs = [str intValue];
    90     self.maxLabel.text = [NSString stringWithFormat:@"%@ %@",NSLocalizedString(@"Max Hogs:",@""),str];
    88     self.maxLabel.text = [NSString stringWithFormat:@"%@ %@",NSLocalizedString(@"Max Hogs:",@""),str];
    91 }
    89 }
    92 
    90 
    93 -(NSDictionary *)getDataForEngine {
    91 - (NSDictionary *)getDataForEngine {
    94     NSDictionary *dictForEngine = [NSDictionary dictionaryWithObjectsAndKeys:
    92     NSDictionary *dictForEngine = [NSDictionary dictionaryWithObjectsAndKeys:
    95                                    self.seedCommand,@"seedCommand",
    93                                    self.seedCommand,@"seedCommand",
    96                                    self.templateFilterCommand,@"templateFilterCommand",
    94                                    self.templateFilterCommand,@"templateFilterCommand",
    97                                    self.mapGenCommand,@"mapGenCommand",
    95                                    self.mapGenCommand,@"mapGenCommand",
    98                                    self.mazeSizeCommand,@"mazeSizeCommand",
    96                                    self.mazeSizeCommand,@"mazeSizeCommand",
   100     return dictForEngine;
    98     return dictForEngine;
   101 }
    99 }
   102 
   100 
   103 #pragma mark -
   101 #pragma mark -
   104 #pragma mark Table view data source
   102 #pragma mark Table view data source
   105 -(NSInteger) numberOfSectionsInTableView:(UITableView *)tableView {
   103 - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
   106     return 1;
   104     return 1;
   107 }
   105 }
   108 
   106 
   109 -(NSInteger) tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger) section {
   107 - (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section {
   110     return [[self.dataSourceArray objectAtIndex:scIndex] count];
   108     return [[self.dataSourceArray objectAtIndex:scIndex] count];
   111 }
   109 }
   112 
   110 
   113 -(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   111 -(UITableViewCell *)tableView:(UITableView *)aTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
   114     static NSString *CellIdentifier = @"Cell";
   112     static NSString *CellIdentifier = @"Cell";
   115     NSUInteger row = [indexPath row];
   113     NSUInteger row = [indexPath row];
   116 
   114 
   117     UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
   115     UITableViewCell *cell = [aTableView dequeueReusableCellWithIdentifier:CellIdentifier];
   118     if (cell == nil)
   116     if (cell == nil)
   119         cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
   117         cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
   120 
   118 
   121     NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
   119     NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
   122 
   120 
   123     NSString *labelString = [source objectAtIndex:row];
   121     NSString *labelString = [source objectAtIndex:row];
   124     cell.textLabel.text = labelString;
   122     cell.textLabel.text = labelString;
   128     cell.textLabel.backgroundColor = [UIColor clearColor];
   126     cell.textLabel.backgroundColor = [UIColor clearColor];
   129 
   127 
   130     if (isRandomness()) {
   128     if (isRandomness()) {
   131         UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),labelString]];
   129         UIImage *image = [[UIImage alloc] initWithContentsOfFile:[NSString stringWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),labelString]];
   132         cell.imageView.image = image;
   130         cell.imageView.image = image;
   133         [image release];
       
   134     } else
   131     } else
   135         cell.imageView.image = nil;
   132         cell.imageView.image = nil;
   136 
   133 
   137     if (row == [self.lastIndexPath row]) {
   134     if (row == [self.lastIndexPath row]) {
   138         UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
   135         UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
   139         cell.accessoryView = checkbox;
   136         cell.accessoryView = checkbox;
   140         [checkbox release];
       
   141     } else
   137     } else
   142         cell.accessoryView = nil;
   138         cell.accessoryView = nil;
   143 
   139 
   144     cell.backgroundColor = [UIColor blackColorTransparent];
   140     cell.backgroundColor = [UIColor blackColorTransparent];
   145     return cell;
   141     return cell;
   146 }
   142 }
   147 
   143 
   148 // this set details for a static map (called by didSelectRowAtIndexPath)
   144 // this set details for a static map (called by didSelectRowAtIndexPath)
   149 -(void) setDetailsForStaticMap:(NSInteger) index {
   145 - (void)setDetailsForStaticMap:(NSInteger)index {
   150     NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
   146     NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
   151 
   147 
   152     NSString *fileCfg = [[NSString alloc] initWithFormat:@"%@/%@/map.cfg",
   148     NSString *fileCfg = [[NSString alloc] initWithFormat:@"%@/%@/map.cfg",
   153                          (scIndex == 1) ? MAPS_DIRECTORY() : MISSIONS_DIRECTORY(),[source objectAtIndex:index]];
   149                          (scIndex == 1) ? MAPS_DIRECTORY() : MISSIONS_DIRECTORY(),[source objectAtIndex:index]];
   154     NSString *contents = [[NSString alloc] initWithContentsOfFile:fileCfg encoding:NSUTF8StringEncoding error:NULL];
   150     NSString *contents = [[NSString alloc] initWithContentsOfFile:fileCfg encoding:NSUTF8StringEncoding error:NULL];
   155     [fileCfg release];
       
   156     NSArray *split = [contents componentsSeparatedByString:@"\n"];
   151     NSArray *split = [contents componentsSeparatedByString:@"\n"];
   157     [contents release];
       
   158 
   152 
   159     // if the number is not set we keep 18 standard;
   153     // if the number is not set we keep 18 standard;
   160     // sometimes it's not set but there are trailing characters, we get around them with the second equation
   154     // sometimes it's not set but there are trailing characters, we get around them with the second equation
   161     NSString *max;
   155     NSString *max;
   162     if ([split count] > 1 && [[split objectAtIndex:1] intValue] > 0)
   156     if ([split count] > 1 && [[split objectAtIndex:1] intValue] > 0)
   174         self.missionCommand = [NSString stringWithFormat:@"escript Missions/Maps/%@/map.lua",[source objectAtIndex:index]];
   168         self.missionCommand = [NSString stringWithFormat:@"escript Missions/Maps/%@/map.lua",[source objectAtIndex:index]];
   175 }
   169 }
   176 
   170 
   177 #pragma mark -
   171 #pragma mark -
   178 #pragma mark Table view delegate
   172 #pragma mark Table view delegate
   179 -(void) tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   173 - (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
   180     NSInteger newRow = [indexPath row];
   174     NSInteger newRow = [indexPath row];
   181     NSInteger oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
   175     NSInteger oldRow = (lastIndexPath != nil) ? [lastIndexPath row] : -1;
   182 
   176 
   183     if (newRow != oldRow) {
   177     if (newRow != oldRow) {
   184         NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
   178         NSArray *source = [self.dataSourceArray objectAtIndex:scIndex];
   193         }
   187         }
   194 
   188 
   195         UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath];
   189         UITableViewCell *newCell = [aTableView cellForRowAtIndexPath:indexPath];
   196         UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
   190         UIImageView *checkbox = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:@"checkbox.png"]];
   197         newCell.accessoryView = checkbox;
   191         newCell.accessoryView = checkbox;
   198         [checkbox release];
       
   199         UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:self.lastIndexPath];
   192         UITableViewCell *oldCell = [aTableView cellForRowAtIndexPath:self.lastIndexPath];
   200         oldCell.accessoryView = nil;
   193         oldCell.accessoryView = nil;
   201 
   194 
   202         self.lastIndexPath = indexPath;
   195         self.lastIndexPath = indexPath;
   203         [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
   196         [aTableView selectRowAtIndexPath:indexPath animated:YES scrollPosition:UITableViewScrollPositionNone];
   207 
   200 
   208 #pragma mark -
   201 #pragma mark -
   209 #pragma mark slider & segmentedControl & button
   202 #pragma mark slider & segmentedControl & button
   210 // this updates the label and the command keys when the slider is moved, depending of the selection in segmentedControl
   203 // this updates the label and the command keys when the slider is moved, depending of the selection in segmentedControl
   211 // no methods are called by this routine and you can pass nil to it
   204 // no methods are called by this routine and you can pass nil to it
   212 -(IBAction) sliderChanged:(id) sender {
   205 - (IBAction)sliderChanged:(id)sender {
   213     NSString *labelText;
   206     NSString *labelText;
   214     NSString *templateCommand;
   207     NSString *templateCommand;
   215     NSString *mazeCommand;
   208     NSString *mazeCommand;
   216 
   209 
   217     switch ((int)(self.slider.value*100)) {
   210     switch ((int)(self.slider.value*100)) {
   280     self.templateFilterCommand = templateCommand;
   273     self.templateFilterCommand = templateCommand;
   281     self.mazeSizeCommand = mazeCommand;
   274     self.mazeSizeCommand = mazeCommand;
   282 }
   275 }
   283 
   276 
   284 // update preview (if not busy and if its value really changed) as soon as the user lifts its finger up
   277 // update preview (if not busy and if its value really changed) as soon as the user lifts its finger up
   285 -(IBAction) sliderEndedChanging:(id) sender {
   278 - (IBAction)sliderEndedChanging:(id)sender {
   286     int num = (int) (self.slider.value * 100);
   279     int num = (int) (self.slider.value * 100);
   287     if (oldValue != num) {
   280     if (oldValue != num) {
   288         [self updatePreview];
   281         [self updatePreview];
   289         oldValue = num;
   282         oldValue = num;
   290     }
   283     }
   291     [[AudioManagerController mainManager] playClickSound];
   284     [[AudioManagerController mainManager] playClickSound];
   292 }
   285 }
   293 
   286 
   294 // perform actions based on the activated section, then call updatePreview to visually update the selection
   287 // perform actions based on the activated section, then call updatePreview to visually update the selection
   295 // and if necessary update the table with a slide animation
   288 // and if necessary update the table with a slide animation
   296 -(IBAction) segmentedControlChanged:(id) sender {
   289 - (IBAction)segmentedControlChanged:(id)sender {
   297     NSString *mapgen, *staticmap, *mission;
   290     NSString *mapgen, *staticmap, *mission;
   298     NSInteger newPage = self.segmentedControl.selectedSegmentIndex;
   291     NSInteger newPage = self.segmentedControl.selectedSegmentIndex;
   299 
   292 
   300     [[AudioManagerController mainManager] playSelectSound];
   293     [[AudioManagerController mainManager] playSelectSound];
   301     switch (newPage) {
   294     switch (newPage) {
   370         NSMutableArray *themeArray = [[NSMutableArray alloc] init];
   363         NSMutableArray *themeArray = [[NSMutableArray alloc] init];
   371         for (NSString *themeName in themeArrayFull) {
   364         for (NSString *themeName in themeArrayFull) {
   372             NSString *checkPath = [[NSString alloc] initWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),themeName];
   365             NSString *checkPath = [[NSString alloc] initWithFormat:@"%@/%@/icon.png",THEMES_DIRECTORY(),themeName];
   373             if ([[NSFileManager defaultManager] fileExistsAtPath:checkPath])
   366             if ([[NSFileManager defaultManager] fileExistsAtPath:checkPath])
   374                 [themeArray addObject:themeName];
   367                 [themeArray addObject:themeName];
   375             [checkPath release];
       
   376         }
   368         }
   377 
   369 
   378         // remove images that are too big for certain devices without loading the whole image
   370         // remove images that are too big for certain devices without loading the whole image
   379         NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL];
   371         NSArray *mapArrayFull = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:MAPS_DIRECTORY() error:NULL];
   380         NSMutableArray *mapArray = [[NSMutableArray alloc] init];
   372         NSMutableArray *mapArray = [[NSMutableArray alloc] init];
   396             if (IS_NOT_VERY_POWERFUL(model) && imgSize.height > 1280.0f)
   388             if (IS_NOT_VERY_POWERFUL(model) && imgSize.height > 1280.0f)
   397                 continue;
   389                 continue;
   398             [missionArray addObject:str];
   390             [missionArray addObject:str];
   399         }
   391         }
   400         NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil];
   392         NSArray *array = [[NSArray alloc] initWithObjects:themeArray,mapArray,themeArray,missionArray,nil];
   401         [missionArray release];
       
   402         [themeArray release];
       
   403         [mapArray release];
       
   404 
   393 
   405         self.dataSourceArray = array;
   394         self.dataSourceArray = array;
   406         [array release];
       
   407     }
   395     }
   408     return dataSourceArray;
   396     return dataSourceArray;
   409 }
   397 }
   410 
   398 
   411 -(void) viewDidLoad {
   399 - (void)viewDidLoad {
   412     [super viewDidLoad];
   400     [super viewDidLoad];
   413     
   401     
   414     [self localizeSegmentedControl];
   402     [self localizeSegmentedControl];
   415     
   403     
   416     // initialize some "default" values
   404     // initialize some "default" values
   434         self.tableView.contentInset = UIEdgeInsetsMake(10, 0, 10, 0);
   422         self.tableView.contentInset = UIEdgeInsetsMake(10, 0, 10, 0);
   435 
   423 
   436         UILabel *backLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 14, 300, 190) andTitle:nil withBorderWidth:2.3f];
   424         UILabel *backLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 14, 300, 190) andTitle:nil withBorderWidth:2.3f];
   437         backLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
   425         backLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
   438         [self.view insertSubview:backLabel belowSubview:self.segmentedControl];
   426         [self.view insertSubview:backLabel belowSubview:self.segmentedControl];
   439         [backLabel release];
       
   440     }
   427     }
   441     self.tableView.separatorColor = [UIColor whiteColor];
   428     self.tableView.separatorColor = [UIColor whiteColor];
   442     self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
   429     self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
   443 }
   430 }
   444 
   431 
   445 -(void) viewWillAppear:(BOOL)animated {
   432 - (void)viewWillAppear:(BOOL)animated {
   446     [super viewWillAppear:animated];
   433     [super viewWillAppear:animated];
   447 }
   434 }
   448 
   435 
   449 -(void) viewDidAppear:(BOOL) animated {
   436 - (void)viewDidAppear:(BOOL) animated {
   450     [self updatePreview];
   437     [self updatePreview];
   451     [super viewDidAppear:animated];
   438     [super viewDidAppear:animated];
   452 }
   439 }
   453 
   440 
   454 -(void) viewDidUnload {
   441 - (void)didReceiveMemoryWarning {
   455     self.previewButton = nil;
       
   456     self.seedCommand = nil;
       
   457     self.templateFilterCommand = nil;
       
   458     self.mapGenCommand = nil;
       
   459     self.mazeSizeCommand = nil;
       
   460     self.themeCommand = nil;
       
   461     self.staticMapCommand = nil;
       
   462     self.missionCommand = nil;
       
   463 
       
   464     self.tableView = nil;
       
   465     self.maxLabel = nil;
       
   466     self.segmentedControl = nil;
       
   467     self.slider = nil;
       
   468 
       
   469     self.lastIndexPath = nil;
       
   470     self.dataSourceArray = nil;
       
   471 
       
   472     MSG_DIDUNLOAD();
       
   473     [super viewDidUnload];
       
   474 }
       
   475 
       
   476 -(void) didReceiveMemoryWarning {
       
   477     self.dataSourceArray = nil;
   442     self.dataSourceArray = nil;
   478     [super didReceiveMemoryWarning];
   443     [super didReceiveMemoryWarning];
   479 
   444 
   480     if (self.view.superview == nil) {
   445     if (self.view.superview == nil) {
   481         self.previewButton = nil;
   446         self.previewButton = nil;
   485     }
   450     }
   486 
   451 
   487     MSG_MEMCLEAN();
   452     MSG_MEMCLEAN();
   488 }
   453 }
   489 
   454 
   490 -(void) dealloc {
       
   491     releaseAndNil(seedCommand);
       
   492     releaseAndNil(templateFilterCommand);
       
   493     releaseAndNil(mapGenCommand);
       
   494     releaseAndNil(mazeSizeCommand);
       
   495     releaseAndNil(themeCommand);
       
   496     releaseAndNil(staticMapCommand);
       
   497     releaseAndNil(missionCommand);
       
   498 
       
   499     releaseAndNil(previewButton);
       
   500     releaseAndNil(tableView);
       
   501     releaseAndNil(maxLabel);
       
   502     releaseAndNil(segmentedControl);
       
   503     releaseAndNil(slider);
       
   504 
       
   505     releaseAndNil(lastIndexPath);
       
   506     releaseAndNil(dataSourceArray);
       
   507 
       
   508     [super dealloc];
       
   509 }
       
   510 
       
   511 @end
   455 @end