2011-05-05 9 views
0

검정색 배경을 내 테이블 행이나 추가 된 ImageViews에 할당 할 수 없습니다. ..내보기에 검정색 배경을 할당 할 수 없습니다.

UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
if (cell == nil) { 
    cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; 
} 

// Configure the cell... 
cell.textLabel.text = [self wordAtIndexPath:indexPath]; 
cell.accessoryType = UITableViewCellEditingStyleNone; 
cell.backgroundColor = [UIColor colorWithRed: 0.0 green: 0.0 blue: 0.0 alpha: 1.0]; 

//NSString *url = self.imageURL; 
//dispatch_queue_t callerQueue = dispatch_get_current_queue(); 

dispatch_queue_t downloadQueue = dispatch_queue_create("Flickr downloader in Photo", NULL); 
dispatch_async(downloadQueue, ^{ 
    NSData *image = [FlickrFetcher imageDataFromPhotoId:@"2654899252"]; 
    NSData *image2 = [FlickrFetcher imageDataFromPhotoId:@"2654072649"]; 
    NSData *image3 = [FlickrFetcher imageDataFromPhotoId:@"2654072293"];  /*dispatch_async(callerQueue, ^{ 
     processImage(imageData); 
    });*/ 

    UIImageView *imageView = nil; 

    if(image) imageView = [[UIImageView alloc] initWithImage:[UIImage imageWithData: image]]; 

    UIImageView *imageView2 = nil; 
    if(image2) imageView2 = [[UIImageView alloc] initWithImage:[UIImage imageWithData: image2]]; 

    UIImageView *imageView3 = nil; 
    if(image3) imageView3 = [[UIImageView alloc] initWithImage:[UIImage imageWithData: image3]]; 

    imageView.frame = CGRectMake(0.0, 0.0, 220, 200); 
    imageView2.frame = CGRectMake(240.0, 0.0, 220, 200); 
    imageView3.frame = CGRectMake(480.0, 0.0, 220, 200); 

    imageView.backgroundColor = [UIColor colorWithRed: 0.0 green: 0.0 blue: 0.0 alpha: 1.0]; 
    imageView2.backgroundColor = [UIColor colorWithRed: 0.0 green: 0.0 blue: 0.0 alpha: 1.0]; 
    imageView3.backgroundColor = [UIColor colorWithRed: 0.0 green: 0.0 blue: 0.0 alpha: 1.0]; 



    [cell addSubview:imageView]; 
    [cell addSubview:imageView2]; 
    [cell addSubview:imageView3]; 

    [imageView release]; 
    [imageView2 release]; 
    [imageView3 release]; 
}); 
dispatch_release(downloadQueue); 
+0

아마도 이미지의 배경이 흰색일까요? –

+0

@Jan Gressmann 이미지에 테두리가 없으며 코드에서 볼 수있는 것처럼 거리의 20 개 지점에 위치합니다. – aneuryzm

+0

좋습니다 다음을 추가하십시오. cell.contentView.backgroundColor = [UIColor black]; 및 cell.backgroundView.backgroundColor = [UIColor 검정]; –

답변

0

괜찮 시도는 추가 :

cell.contentView.backgroundColor = [UIColor blackColor]; 
cell.backgroundView.backgroundColor = [UIColor blackColor]; 

라인이 UITableViewCellSeparatorStyleNone

에 tableView.separatorStyle를 설정하여 제거된다 (각 행은 여러 imageViews이있는 배경은 항상 흰색입니다 이건 내 코드입니다 ViewController에 UITableView이 있어야합니다. UITableViewController viewDidLoad 메서드에서 속성을 설정하는 경우 :

-(void) viewDidLoad { 
    [super viewDidLoad]; 
    self.tableView.separatorStyle = UITableViewCellSeparatorStyleNone; 
} 
관련 문제