我需要加載一個單元格中的圖像,我沿着我的圖像得到一個白色邊框。我從鏈接調用圖像,它看起來像這樣。UIImageView中的內容模式問題,當它設置爲ASpectFill
但我的形象看起來像
我得到我的圖像白色邊框的左,右side.Here是我的形象代碼
UIImageView *item=[[UIImageView alloc]initWithFrame:CGRectMake(0, 0, 115, 130)];
NSString *imgstring=[NSString stringWithFormat: @"%@",[[mutarray objectAtIndex:indexPath.row ] valueForKey:@"imgurl"]];
NSURL *imgurl=[NSURL URLWithString:imgstring];
UIImage *image=[UIImage imageWithData:[NSData dataWithContentsOfURL:imgurl]];
[item setBackgroundColor:[UIColor clearColor]];
item.contentMode=UIViewContentModeScaleToFill;
[item setImage:image];
[cell.contentView addSubview:item];
請指導...
我猜你的形象圖幀大小是錯誤的。嘗試給一些背景顏色來測試。像黃色到單元格背景和綠色到圖像背景。然後將這些圖像添加到此處,這對解決您問題的訪問者會有所幫助。 – Mrunal 2012-07-24 15:05:31
我試過,但都一樣.. – Dany 2012-07-24 15:18:40