2009-09-14 4 views
0
if (cell == nil) { 

//cell = [[[UITableViewCell alloc] initWithFrame:CGRectMake(0, 0, 260, 44) reuseIdentifier:CellIdentifier] autorelease]; 

//The line above works like a breeze 

cell = [[[UITableViewCell alloc] initWithStyle:initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier] autorelease]; //This is the line that is causing me problems 
} 

Ce sont les journaux d'erreur:Impossible d'initialiser UITableViewCell

/Users/myname/Downloads/myApp/Classes/MyTableView.m: In function '-[MyTableView tableView:cellForRowAtIndexPath:]': 

/Users/myname/Downloads/myApp/Classes/MyTableView.m:88: error: 'initWithStyle' undeclared (first use in this function) 

/Users/myname/Downloads/myApp/Classes/MyTableView.m:88: error: (Each undeclared identifier is reported only once 

/Users/myname/Downloads/myApp/Classes/MyTableView.m:88: error: for each function it appears in.) 

/Users/myname/Downloads/myApp/Classes/MyTableView.m:88: error: 'UITableViewCellStyleValue1' undeclared (first use in this function) 

/Users/myname/Downloads/myApp/Classes/MyTableView.m:88: warning: no '-initWithStyle::reuseIdentifier:' method found 

/Users/myname/Downloads/myApp/Classes/MyTableView.m:88: warning: (Messages without a matching method signature 

/Users/myname/Downloads/myApp/Classes/MyTableView.m:88: warning: will be assumed to return 'id' and accept 

/Users/myname/Downloads/myApp/Classes/MyTableView.m:88: warning: '...' as arguments.) 

Répondre

1

Compilez-vous pour OS 3? Je ne crois pas UITableViewCellStyleValue1 existait dans OS 2 ...

+0

Comment vérifiez-vous cela? Je crois que je compile pour OS 3 – Minar

+0

Vérifiez les informations du projet, section générale "Base SDK pour toutes les configurations": est-ce iPhone Device 3.0? – JOM

1

La méthode correcte est

initWithStyle:reuseIdentifier: 

Vous utilisez à la place

initWithStyle:initWithStyle:reuseIdentifier: 

supprimer simplement redondant initWithStyle: et cela fonctionnera.

0

UITableViewCellStyleValue1 n'a pas été défini dans les SDK avant 3.0. Vérifiez le SDK que vous utilisez.

+0

Jongsma l'a dit en premier. – mahboudz

Questions connexes