У меня есть следующее:
Класс № 1
.h файл:
myAudiCiviliteInputViewController *civiliteInputViewController;
.m файл:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tableViewEtape4 deselectRowAtIndexPath:indexPath animated:NO];
civiliteInputViewController = [[myAudiCiviliteInputViewController alloc] init];
[self.navigationController pushViewController:civiliteInputViewController animated:YES];
[civiliteInputViewController release];
UIButton* customView = [UIButton buttonWithType: UIButtonTypeInfoLight];
[customView setFrame:CGRectMake(0, 0, 60, 31)];
[customView setImage:[UIImage imageNamed:@"nc_btn_ok.png"] forState:UIControlStateNormal];
[customView addTarget:self action:@selector(okPressed) forControlEvents:UIControlEventTouchDown];
UIBarButtonItem *envoyerButton = [[UIBarButtonItem alloc] initWithCustomView: customView];
[self.navigationController.navigationBar.topItem setRightBarButtonItem:envoyerButton];
[customView release];
}
-(void) okPressed{
self.civiliteString= civiliteInputViewController.civiliteInputString;
civiliteLabel.text = self.civiliteString;
[self.navigationController popViewControllerAnimated:YES];
}
Когда я нажимаю на tableView, я перехожу на класс Number 2
.
Класс Number2 myAudiCiviliteInputViewController
@synthesize civiliteInputString;
- (void)dealloc
{
[civiliteInputString release];
[tabelViewCivilite release];
[tableViewArray release];
[super dealloc];
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
tableViewArray = [[NSMutableArray alloc] initWithObjects:@"Madame", @"Mademoiselle", @"Monsieur", nil];
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CellRecherchePartenaires"];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"CellRecherchePartenaires"] autorelease];
}
// Set up the cell...
[[cell textLabel] setText: [tableViewArray objectAtIndex:indexPath.row]] ;
return cell;
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
[tabelViewCivilite deselectRowAtIndexPath:indexPath animated:YES];
UITableViewCell *selectedCell = [tableView cellForRowAtIndexPath:indexPath];
self.civiliteInputString = selectedCell.textLabel.text;
[tableView reloadData];
}
Когда я перехожу с Class Number1
на Class Number2
, это работает. Когда я возвращаюсь от Class Number2
до Class Number1
, я получаю EXC_BAD_ACCESS
в Class Number2
, в этой строке:
[super dealloc];
Есть идеи почему?