セルに関する情報を 1 行で追加できるようにするメソッドを customCell.m に追加したいので、以下を追加しました。
-(void) addInfo:(NSString*) pTitre:(NSString*) pDescritption:(NSString*) pDate: (NSString*)pImage
{
[[self titre] setText:pTitre];
[[self description] setText:pDescritption];
[[self date] setText:pDate];
[[self couverture] setImage:[UIImage imageNamed:pImage]];
}
しかし、次のように mytableview.m でメソッドを呼び出すと:
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return 3 ;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *MyIdentifier = @"firstviewcustomcellCell";
firstviewcustomcellCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
if (cell == nil)
{
NSArray *topLevelObject=[[NSBundle mainBundle] loadNibNamed:@"firestViewCell" owner:nil options:nil];
for(id currentObject in topLevelObject)
{
if([currentObject isKindOfClass:[firstviewcustomcellCell class]])
{
cell=(firstviewcustomcellCell*) currentObject;
break;
}
}
}
[cell addInfo:
@"journal 1":
@"description 1":
@"01/02/2012":
@"second.png"];
[cell addInfo:
@"journal 2":
@"description 2":
@"01/02/2012":
@"second.png"];
return cell;
}
これはそれが示すものです:
http://img213.imageshack.us/img213/2346/capturedcran20120416142.png
お時間をいただきありがとうございます