Je reçois un avertissement de mémoire: "Décrément incorrect du compte de référence d'un objet qui n'appartient pas à ce point par l'appelant "pour challengeCell à la ligne marquée.Décrément incorrect du compte de référence d'un objet qui n'appartient pas à ce point à l'appelant dans l'iphone
myIdentifier = @"ChallengTblVwCell";
ChallengeTableViewCell *challengeCell = (ChallengeTableViewCell *)[tableView dequeueReusableCellWithIdentifier:myIdentifier];
if(challengeCell == nil)
{
[[ NSBundle mainBundle ] loadNibNamed:@"ChallengeTableViewCell" owner:self options:nil ];
challengeCell = challengeTblCell;
}
else {
//some code
}
challengeInstance = [genericArray objectAtIndex:indexPath.row];
NSString *challengeTitle = challengeInstance.elecompany;
[challengeCell initWithTitle:challengeTitle subTitle:challengeSubtitle _votes:challengeVotes content:challengeContent _time:challengeTime _image:challengeImage noComments:challengeCommentsNo]; //Warning coming at this line
return (UITableViewCell *)challengeCell;
EDIT:
-(id)initWithTitle:(NSString *)_title content:(NSString *)_content fromName:(NSString *)_fromName _time:(NSString *)_time_ _image:(NSString *)_image_ noComments:(NSInteger)commentsNo
{
//Labels are created through interface builder
[_lbltitle_ setText:_title];
[_lbltime setText:_time_];
[lblcontent setText:_content];
[lblsubTitle setText:_fromName];
[lblnoOfComments setText:[NSString stringWithFormat:@"%d",commentsNo]];
// code for adjusting label height according to content.
return self;
}
J'ai fait cette classe distincte pour la gestion de la cellule pour rendre sa manipulation facile.
Quelqu'un peut-il s'il vous plaît m'aider à résoudre ce problème?
Merci d'avance.
À quoi ressemble la méthode personnalisée initWithTitle? –