i AVONS simple vue qui est le troisième niveau d'un UINavigationController, il montre une table vide à partir d'une plume, voici le code du fichier .m:iOS - initialisation UITableViewCell échouez, EXC_BAD_ACCESS
#import "ThirdLevel.h"
@implementation ThirdLevel
@synthesize lista, categoria;
- (void)viewDidLoad {
[super viewDidLoad];
NSLog(@"Categoria: %@", categoria);
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Overriden to allow any orientation.
return NO;
}
- (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 {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
// Customize the number of rows in the table view.
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
return 20;
}
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
return 100;
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
//newtableView.separatorColor = [UIColor clearColor];
static NSString *CellIdentifier = "Cell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
}
}
- (void)buttonPressed:(id)sender {
NSLog(@"premuto");
}
- (void)dealloc {
[super dealloc];
}
@end
Quand je le lance, le crash de l'appareil et le débogueur dire qu'il ya un EXC_BAD_ACCESS à cette ligne:
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
j'ai le même code dans le deuxième niveau du UINavigationController et il travaille bien, don realy » Je ne comprends pas ce qui ne va pas.
Merci pour toute aide :)
... incroyable ... appelez-moi idiote: D merci beaucoup :) –
Je ne comprends pas pourquoi ils ne pas lire les avertissements .... – Nekto
@Marco Faion personne n'est parfait dans ce monde.la pratique nous rendra mieux.que c'est.cool. –