이상한 문제가 있습니다.TableCell의 UIImageVIew에 올바른 SIZE가 표시되지 않습니다.
내가 셀이있는 TableView (파란색 테두리)에 약간의 공간이 있는지 원하는, 그래서 난 여분의보기를 넣어 : 나는 3 개 레이블 하나의 UIImageView와 사용자 정의 테이블 셀을 생성하기 위해 인터페이스 빌더를 사용 세포 내부. 보시다시피, UIImageVIew는 실제로 두 개의 라벨보다 작고 높지는 않지만, 장치에서 코드를 실행하면 UIImageView는 흰색보기로 높으며 Label을 약간 커버합니다. 내 코드에서 수행 할 수있는 유일한 작업은 다음과 같습니다.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier1 = @"CustomCellReuseID";
GTEventCustomCell *eventCell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
if (eventCell == nil) {
eventCell = [[GTEventCustomCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1];
}
// Configure the cell...
[eventCell.imageView setImage:[UIImage imageNamed:@"heart.png"]];
.
.
.
뭐가 잘못 됐나요? 난 당신이 정의 셀 내부의 개체에 대한 자동 레이아웃 제약을 놓친하지 않은 희망
eventCell.imageView.contentMode = UIViewContentModeScaleAspectFit;
ImageView에서 heart.png 크기의 프레임을 가져 옵니까? ImageCell.imageView.frame을 설정 한 다음 이미지 뷰 설정을 변경하여 –
으로 채우기 위해 @OlegFedorov가 modeScale을 시도한 것처럼 cliptoBounds = yes를 사용할 수도 있습니다. – santhu