project_files/HedgewarsMobile/Classes/WeaponSettingsViewController.m
author nemo
Sun, 20 Jun 2010 22:35:10 -0400
changeset 3526 a1d2180fef42
parent 3514 59dbd31e9953
child 3522 156c04c6a3d8
permissions -rw-r--r--
Replace SHA1 with adler32. For simple purposes of checking to see if players are playing the same map, this should be quite adequate and runs 15 times faster.
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
3356
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     1
//
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     2
//  WeaponSettingsViewController.m
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     3
//  HedgewarsMobile
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     4
//
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     5
//  Created by Vittorio on 19/04/10.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     6
//  Copyright 2010 __MyCompanyName__. All rights reserved.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     7
//
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     8
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
     9
#import "WeaponSettingsViewController.h"
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    10
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    11
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    12
@implementation WeaponSettingsViewController
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    13
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    14
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    15
#pragma mark -
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    16
#pragma mark Initialization
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    17
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    18
/*
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    19
- (id)initWithStyle:(UITableViewStyle)style {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    20
    // Override initWithStyle: if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    21
    if ((self = [super initWithStyle:style])) {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    22
    }
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    23
    return self;
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    24
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    25
*/
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    26
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    27
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    28
#pragma mark -
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    29
#pragma mark View lifecycle
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    30
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    31
/*
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    32
- (void)viewDidLoad {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    33
    [super viewDidLoad];
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    34
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    35
    // Uncomment the following line to preserve selection between presentations.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    36
    self.clearsSelectionOnViewWillAppear = NO;
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    37
 
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    38
    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    39
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    40
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    41
*/
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    42
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    43
/*
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    44
- (void)viewWillAppear:(BOOL)animated {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    45
    [super viewWillAppear:animated];
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    46
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    47
*/
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    48
/*
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    49
- (void)viewDidAppear:(BOOL)animated {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    50
    [super viewDidAppear:animated];
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    51
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    52
*/
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    53
/*
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    54
- (void)viewWillDisappear:(BOOL)animated {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    55
    [super viewWillDisappear:animated];
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    56
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    57
*/
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    58
/*
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    59
- (void)viewDidDisappear:(BOOL)animated {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    60
    [super viewDidDisappear:animated];
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    61
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    62
*/
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    63
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    64
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    65
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    66
    // Override to allow orientations other than the default portrait orientation.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    67
    return YES;
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    68
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    69
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    70
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    71
#pragma mark -
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    72
#pragma mark Table view data source
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    73
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    74
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    75
    // Return the number of sections.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    76
    return 1;
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    77
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    78
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    79
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    80
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    81
    // Return the number of rows in the section.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    82
    return 1;
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    83
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    84
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    85
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    86
// Customize the appearance of table view cells.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    87
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    88
    
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    89
    static NSString *CellIdentifier = @"Cell";
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    90
    
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    91
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    92
    if (cell == nil) {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    93
        cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    94
    }
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    95
    
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    96
    // Configure the cell...
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    97
    
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    98
    return cell;
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
    99
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   100
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   101
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   102
/*
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   103
// Override to support conditional editing of the table view.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   104
- (BOOL)tableView:(UITableView *)tableView canEditRowAtIndexPath:(NSIndexPath *)indexPath {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   105
    // Return NO if you do not want the specified item to be editable.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   106
    return YES;
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   107
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   108
*/
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   109
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   110
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   111
/*
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   112
// Override to support editing the table view.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   113
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   114
    
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   115
    if (editingStyle == UITableViewCellEditingStyleDelete) {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   116
        // Delete the row from the data source
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   117
        [tableView deleteRowsAtIndexPaths:[NSArray arrayWithObject:indexPath] withRowAnimation:YES];
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   118
    }   
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   119
    else if (editingStyle == UITableViewCellEditingStyleInsert) {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   120
        // Create a new instance of the appropriate class, insert it into the array, and add a new row to the table view
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   121
    }   
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   122
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   123
*/
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   124
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   125
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   126
/*
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   127
// Override to support rearranging the table view.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   128
- (void)tableView:(UITableView *)tableView moveRowAtIndexPath:(NSIndexPath *)fromIndexPath toIndexPath:(NSIndexPath *)toIndexPath {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   129
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   130
*/
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   131
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   132
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   133
/*
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   134
// Override to support conditional rearranging of the table view.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   135
- (BOOL)tableView:(UITableView *)tableView canMoveRowAtIndexPath:(NSIndexPath *)indexPath {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   136
    // Return NO if you do not want the item to be re-orderable.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   137
    return YES;
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   138
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   139
*/
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   140
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   141
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   142
#pragma mark -
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   143
#pragma mark Table view delegate
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   144
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   145
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   146
    // Navigation logic may go here. Create and push another view controller.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   147
	/*
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   148
	 <#DetailViewController#> *detailViewController = [[<#DetailViewController#> alloc] initWithNibName:@"<#Nib name#>" bundle:nil];
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   149
     // ...
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   150
     // Pass the selected object to the new view controller.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   151
	 [self.navigationController pushViewController:detailViewController animated:YES];
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   152
	 [detailViewController release];
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   153
	 */
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   154
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   155
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   156
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   157
#pragma mark -
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   158
#pragma mark Memory management
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   159
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   160
- (void)didReceiveMemoryWarning {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   161
    // Releases the view if it doesn't have a superview.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   162
    [super didReceiveMemoryWarning];
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   163
    
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   164
    // Relinquish ownership any cached data, images, etc that aren't in use.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   165
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   166
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   167
- (void)viewDidUnload {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   168
    // Relinquish ownership of anything that can be recreated in viewDidLoad or on demand.
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   169
    // For example: self.myOutlet = nil;
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   170
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   171
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   172
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   173
- (void)dealloc {
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   174
    [super dealloc];
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   175
}
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   176
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   177
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   178
@end
3ae3fccb439e add missing controller stubs
koda
parents:
diff changeset
   179