My application is crashing, I think, in RootController.m and I don't know why. It occurs when I am in any view controller and I push the back button. It briefly returns to RootController and then it crashes. There is no messages on the console. I don't think it is the ViewController as I have tried more than one.
Here is the code.
#import "RootViewController.h"
@implementation RootViewController
@synthesize menuData;
- (void)viewDidLoad {
NSArray *array = [[NSArray alloc] initWithObjects: @"Sales", @"Refunds", @"Auth", nil];
self.menuData = array;
[array release];
[super viewDidLoad];
self.title = @"Main Menu";
}
(void)didReceiveMemoryWarning { // Releases the view if it doesn't have a superview. [super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use. }
(void)viewDidUnload { // Release anything that can be recreated in viewDidLoad or on demand. // e.g. self.myOutlet = nil;
self.menuData = nil;
[super viewDidUnload]; }
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { return 1; }
// Customize the number of rows in the table view.
(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return [self.menuData 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]; }
// Configure the cell. NSInteger row = [indexPath row]; cell.text = [menuData objectAtIndex:row]; return cell; }
// Override to support row selection in the table view.
(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
// Navigation logic may go here -- for example, create and push another view controller. //salesViewController *anotherViewController = [[salesViewController alloc] initWithNibName:@"salesView" bundle:nil]; confirmViewController *anotherViewController = [[confirmViewController alloc] initWithNibName:@"confirmView" bundle:nil];
[self.navigationController pushViewController:anotherViewController animated:YES]; [anotherViewController release];
}
(void)dealloc {
[menuData release]; [super dealloc]; }
@end