问题描述
|
我正在使用来自URL的图像创建表格视图,但是直到我在行中按图像时,图像才会调整为所有视图的大小。
知道为什么会这样吗?
这是一个自定义表格视图
我的代码是:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *CellIdentifier = @\"Celula_Noticias\";
Celula_Noticias *cell = (Celula_Noticias*)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
NSArray * top= [[NSBundle mainBundle] loadNibNamed:@\"Celula_Noticias\" owner:self options:nil];
for(id currentObject in top){
if ([currentObject isKindOfClass:[Celula_Noticias class]]) {
cell= (Celula_Noticias *) currentObject;
break;
}
}
}
cell.Image_Noticias_1.image=[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[[noticias objectAtIndex:indexPath.row ] objectAtIndex:0]]]];
cell.Image_Noticias_2.image=[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:[[noticias objectAtIndex:indexPath.row ] objectAtIndex:2]]]];
cell.Titulo_Noticias_1.text=[[noticias objectAtIndex:indexPath.row ] objectAtIndex:1];
cell.Titulo_Noticias_2.text=[[noticias objectAtIndex:indexPath.row ] objectAtIndex:3];
return cell;
}
表格已正确填满,但图像的开头尺寸不正确。
我曾尝试使用CGRectMake,但它仍然无法正常工作。
谢谢。
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)