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