Objective c UITableView单元格的图像
我的一个应用程序在UITableView中具有图像作为细胞背景的特性,在测试时,一切都很好,图像和细胞高度与代码测试完全一样,但在上传时,我尝试通过iphone、ipad下载了几次,细胞被拉伸,测试时采用的测量方法完全不同,图像一点也不清晰,应用程序包含2个大小的图像另一个是视网膜大小@2x,我不知道有什么问题或我遗漏了什么,我使用的是XCode 4.2, 请各位指教, 感谢您的迅速回复, 嗯,它的应用内购买包含许多相册,这些相册都位于uitable view单元格中,每个相册都有一个图像,下载时,图像会发生变化,uitableview会自动刷新,首先在viewDidLoad中设置数组中的图像 " 这就是加载tableView的地方Objective c UITableView单元格的图像,objective-c,ios,xcode,uitableview,ios4,Objective C,Ios,Xcode,Uitableview,Ios4,我的一个应用程序在UITableView中具有图像作为细胞背景的特性,在测试时,一切都很好,图像和细胞高度与代码测试完全一样,但在上传时,我尝试通过iphone、ipad下载了几次,细胞被拉伸,测试时采用的测量方法完全不同,图像一点也不清晰,应用程序包含2个大小的图像另一个是视网膜大小@2x,我不知道有什么问题或我遗漏了什么,我使用的是XCode 4.2, 请各位指教, 感谢您的迅速回复, 嗯,它的应用内购买包含许多相册,这些相册都位于uitable view单元格中,每个相册都有一个图像,下载
-(UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"CellIdentifier";
// NSLog(@"%@",AlbumsImages);
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] autorelease];
}
NSUInteger row = [indexPath row];
NSArray *myPathList = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
NSString *myPath = [myPathList objectAtIndex:0];
NSString* storagePath = [myPath stringByAppendingPathComponent:@"purchasedAlbums.plist"];
NSArray* valueList = [[NSArray alloc] initWithContentsOfFile:storagePath];
UIImage *change1 = [UIImage imageNamed:@"playalbum-06.png"];
UIImage *change2 = [UIImage imageNamed:@"playalbum-07.png"];
UIImage *change3 = [UIImage imageNamed:@"playalbum-08.png"];
UIImage *change4 = [UIImage imageNamed:@"playalbum-09.png"];
UIImage *change5 = [UIImage imageNamed:@"playalbum-11.png"];
UIImage *change6 = [UIImage imageNamed:@"playalbum-12.png"];
UIImage *change7 = [UIImage imageNamed:@"playalbum-10.png"];
UIImage *change8 = [UIImage imageNamed:@"playalbum-13.png"];
int i;
for (i = 0; i <= [AlbumsImages count]; i++) {
if ([[valueList objectAtIndex:i+1] intValue]) {
if (i == 0) {
[AlbumsImages replaceObjectAtIndex:0 withObject:change1];
}
if (i == 1) {
[AlbumsImages replaceObjectAtIndex:1 withObject:change2];
}
if (i == 2) {
[AlbumsImages replaceObjectAtIndex:2 withObject:change3];
}
if (i == 3) {
[AlbumsImages replaceObjectAtIndex:3 withObject:change4];
}
if (i == 4) {
[AlbumsImages replaceObjectAtIndex:4 withObject:change5];
}
if (i == 5) {
[AlbumsImages replaceObjectAtIndex:5 withObject:change6];
}
if (i == 6) {
[AlbumsImages replaceObjectAtIndex:6 withObject:change7];
}
if (i == 7) {
[AlbumsImages replaceObjectAtIndex:7 withObject:change8];
}
}
}
//cell.textLabel.text = [AlbumsView objectAtIndex:row];
cell.imageView.image = [AlbumsImages objectAtIndex:row];
cell.tag=row+1;
return cell;
}
其中change1、2、3…是下载相册时替换的图像。仅使用名称,不使用扩展名
UIImage *change1 = [UIImage imageNamed:@"playalbum-06"];
只使用名称,不使用扩展名
UIImage *change1 = [UIImage imageNamed:@"playalbum-06"];
给出你的代码。。在哪里设置图像。什么时候上传并尝试多次下载是什么意思?还请提供一些代码,以便我们能够了解问题的原因。亲爱的,我非常感谢,问题已被代码修改,请检查并提供建议,如果可能,是否重复?提供您的代码。。在哪里设置图像。什么时候上传并尝试多次下载是什么意思?还请提供一些代码,以便我们可以看到问题的原因。亲爱的,我非常感谢,问题已被修改的代码,请检查和建议,如果可能的话,是否重复?