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"); 
} 

イメージ画像は、画像のプロパティはiOSの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-i-make-uitableviewcells-imageview-a-fixed-size-even-the-image-is-sm) – user523234

答えて

2

です。 セルの画像ビューを設定することはできますが、サイズを変更できないようにreadonlyプロパティです。

カスタム画像ビューを追加することで、目的を解決できます。

+0

私がカスタム画像ビューを使用している場合、すばやくスクロールすると重なってしまいます。だから私はそれを使っていません。 – akk

+1

あなたの "cellForRowAtIndexPath"に "if(cell == nil)"をチェックするコード行をコメントするだけです。 – Reena

+0

それは新しいセルを作成し、それは重複しません。 – Reena

関連する問題