Je veux afficher l'image de fond sur la cellule tableview ... sur ce que j'ai besoin d'afficher mes données.comment afficher l'image à l'arrière-plan à tableview Cellule
Comment faire?
@ merci d'avance ... Toute compétence m'aider.
Je veux afficher l'image de fond sur la cellule tableview ... sur ce que j'ai besoin d'afficher mes données.comment afficher l'image à l'arrière-plan à tableview Cellule
Comment faire?
@ merci d'avance ... Toute compétence m'aider.
Do u voulez définir l'image d'arrière-plan pour votre table ou pour cellule individuelle dans UITableView Si elle permet de régler l'image d'arrière-plan puis procédez comme suit:
UIImage *bgImage = [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"background.png" ofType:nil]];
UIColor *bgColor = [[UIColor alloc] initWithPatternImage:bgImage]; self.view.backgroundColor = bgColor;
[tableName setBackgroundColor:[UIColor clearColor]];
où tableName est le nom de votre uitableview
Si vous souhaitez définir l'image d'arrière-plan pour la cellule UITableView puis procédez comme suit:
cell.backgroundColor = [UIColor clearColor];
UIImageView *cellBG_tap = [[UIImageView alloc] initWithImage:[UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"image.png" ofType:nil]]];
cell.backgroundView = cellBG_tap;
[cellBG_tap release];
définir une classe sur la cellule, puis utilisez CSS pour mettre l'image d'arrière-plan, comme ci-dessous:
<table class="myTable">
<tr>
<td class="myCell"></td>
</tr>
</table>
<style>
.myCell {
background: url(my_image.gif)
}
</style>
Bien sûr, @kiran signifiait utiliser un UITableViewCell, pas une page Web. – Jordan
Cette question est référencée dans «iPhone» et non HTML ou CSS. –
mon mauvais. devrait avoir plus de rouge. –
Une façon est de modifier contentView du UITableViewCell. Par exemple:
//Add custom objects to the cell in here!
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image.jpg"]];
imageView.center = CGPointMake(310, 48);
[cell.contentView addSubview:imageView];
[email protected]"test";
ensemble image de fond comme
UIImageView* img = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"yourImage.png"]];
[cell setBackgroundView:img];
- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath{
cell.textLabel.font =[UIFont systemFontOfSize:20.0];
cell.detailTextLabel.textColor=[UIColor whiteColor];
cell.detailTextLabel.font = [UIFont systemFontOfSize:15.0];
cell.textLabel.backgroundColor = [UIColor clearColor];
cell.detailTextLabel.backgroundColor = [UIColor clearColor];
cell.imageView.image = [UIImage imageNamed:@"Square.gif"];
}
en vue de la table source de données
cellForRowAtIndexPath
if (indexPath.row%2==0) {
UIImageView *img = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"image..."]];
cell.backgroundView=img;
[img release];
J'ai utilisé ce son travail .... @all Merci de votre contribution
Définissez également le cell.backgroundColor = [UIColor clearColor] avant de définir backgroundColor pour la cellule – Swapna
@ swapna Merci - (void) tableView: (UITableView *) tableView willDisplayCell: (UITableViewCell *) cellule pourRowAtIndexPath : (NSIndexPath *) indexPath { \t cell.textLabel.font = [UIFont systemFontOfSize: 20.0]; \t cell.detailTextLabel.textColor = [UIColor whiteColor]; \t cell.detailTextLabel.font = [UIFont systemFontOfSize: 15.0]; \t cell.textLabel.backgroundColor = [UIColor clearColor]; \t cell.detailTextLabel.backgroundColor = [UIColor clearColor]; \t cell.imageView.image = [UIImage imageNamed: @ "Sapphire Square.gif"]; } - utilisé ci-dessus code qui a fonctionné .thanks à tous –