2014-02-25 1 views
0

어떻게 테이블 뷰와 셀 사이에 이미지를 추가 할 수 있습니까? 내 말은,이 이미지는 셀 아래에 있어야하지만 tableview.I 이미지를 추가 할 수 있지만 스크롤 셀의 위치가 변경 될 때 상수 아닙니다. tableview 상수 이미지를 원하는 또한 self.view 이미지를 추가 할하지만 세포가 왔을 때, 이미지가 세포의 아래에있다테이블 뷰와 셀 사이에 이미지를 추가하는 방법

답변

0

당신의 질문은 혼란 스럽다. UITableview의 배경으로 이미지를 추가하고 테이블을 스크롤해도 이미지가 영향을 미치지 않는다는 것을 이해합니다.

해결책 : 셀에 배경색을 명확하게 설정하고 이미지를 아래 언급 된 것처럼 Tableview의 배경으로 추가하십시오.

가있는 viewDidLoad에있는 UITableViewCell의 배경 색상을 취소하는 방법에 따라

UIImageView *tempImageView = [[UIImageView alloc] 
           initWithImage:[UIImage imageNamed:@"iPhone.jpg"]]; 
[tempImageView setFrame:self.tableView.frame]; 
self.tableView.backgroundView = tempImageView; 

추가 코드 다음에 추가합니다.

- (void)tableView:(UITableView *)tableView willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    cell.backgroundColor = [UIColor clearColor]; 
} 

희망이 있습니다. 해피 코딩 :)

+0

그래, 내가 보았던 약간의 변화와 함께 "self.tableView.backgroundView = tempImageView;" @pratik Mistry 감사합니다! UIImageView * tempImageView = [[UIImageView alloc] initWithImage : [UIImage imageNamed : @ "logoend.png"]]]; UIView * logoView = [[UIView alloc] initWithFrame : CGRectMake (0, 0, self.checkinsTable.frame.size.width, self.checkinsTable.frame.size.height)]; [logoView addSubview : tempImageView]; tempImageView.frame = CGRectMake (55, 100, 50, 50); self.checkinsTable.backgroundView = logoView; – user3236289

+0

환영합니다! –