2011-12-27 7 views
1

uitableviewcell에서 같은 이미지 크기의 크기를 조정해야합니다. 다른 뷰를 사용하지 않고 동일한 페이지를 사용하고 있습니다. 나는 모든 것을 놓고 달렸다. 그러나 나는 그 일을 올바르게 할 수있는 방법을 제시 할 수 없었다. 미리 감사드립니다. 여기 코드입니다uitableview 셀 이미지의 크기를 조정하는 방법은 무엇입니까?

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
static NSString *CellIdentifier = @"Cell"; 
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 
if (cell == nil) 
{ 
    cell = [[[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:CellIdentifier] autorelease]; 
} 
int count = 0; 
if(self.editing && indexPath.row != 0) 
    count = 1; 

if(indexPath.row == ([imarry count]) && self.editing) 
{ 
    cell.textLabel.text = @"ADD"; 
    cell.image= [UIImage imageNamed:@""]; 
    return cell; 
} 
cell.textLabel.text = [arry objectAtIndex:indexPath.row]; 
cell.image=[imarry objectAtIndex:(indexPath.row)]; 
return cell;  
} 


- (void)imagePickerController:(UIImagePickerController *)UIPicker didFinishPickingImage:(UIImage *)info editingInfo:(NSDictionary *)dictionary 
{ 
[UIPicker dismissModalViewControllerAnimated:NO]; 
[imarry insertObject:info atIndex:[imarry count]]; 
[Table reloadData]; 
NSLog(@"Uploaded image"); 
} 

이미지 사진은 이미지 속성은 아이폰 OS 3.0에서 더 이상 사용되지 않습니다

enter image description here

+0

다음 제안 사항을 확인하십시오. [SO post] (http://stackoverflow.com/questions/1055495/uitableviewcells-imageview-fit-to-40x40) 그리고이 [SO post] (http://stackoverflow.com/ 질문/2788028/how-do-make-uitableviewcells-imageview-a-fixed-size-even-when-image-is-sm) – user523234

답변

2

입니다. 셀의 이미지 뷰를 설정할 수 있지만 읽기 전용 속성이므로 크기를 조정할 수 없습니다.

사용자 정의 이미지 뷰를 추가하면 용도를 해결할 수 있습니다.

+0

사용자 정의 이미지 뷰를 사용하면 빠르게 스크롤 할 때 겹쳐집니다. 그래서 nly 나는 그것을 사용하지 않는다. – akk

+1

은 "cellForRowAtIndexPath"에서 "if (cell == nil)"을 확인하는 코드 행을 주석 처리합니다. – Reena

+0

그러면 새 셀이 만들어지며 중복되지 않습니다. – Reena

관련 문제