我正在从Parse载入图像并将图像加载到UITableViewCell中,我想根据检索到的图像的大小调整图像视图的大小。我怎样才能做到这一点?如果你需要一个例子,我认为Instagram的大小有不同的图像视图。如何根据图像大小调整图像视图大小?
0
A
回答
0
请检查此链接..它可能对你有帮助..
http://candycode.io/dynamic-uitableview-height-for-downloaded-images/
0
您可以通过使用自定义UITableViewCell
调整图像查看,如果要实现自定义的电池我可以分享示例代码。
创建新的笔尖CustomCell
和添加IBOutlet
为UILabel
(如果需要)和UIImageView
。
@interface CustomTableViewCell : UITableViewCell
@property (nonatomic, retain) IBOutlet UILabel *nameLabel;
@property (nonatomic, retain) IBOutlet UIImageView *thumbnailImageView;
@end
然后在课堂上,你回电池,不要使用自定单元
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString * simpleTableIdentifier = @"CustomTableViewCell";
CustomTableViewCell *cell = (CustomTableViewCell *)[tableView dequeueReusableCellWithIdentifier:simpleTableIdentifier];
if (cell == nil)
{
NSArray *nib = [[NSBundle mainBundle] loadNibNamed:@"CustomCell" owner:self options:nil];
cell = [nib objectAtIndex:0];
}
cell.nameLabel.text = @"If you want to set any text";
[cell.thumbnailImageView setImage:[UIImage imageNamed:@"Replace Image Name"]];
cell.thumbnailImageView.frame = CustomFrameYouWantToSet;
return cell;
}
您也可以参考以下实现自定义TableViewCell教程如下实施。
http://www.appcoda.com/customize-table-view-cells-for-uitableview/ http://code.tutsplus.com/tutorials/ios-sdk-crafting-custom-uitableview-cells--mobile-15702
相关问题
- 1. 如何根据原始图像比例调整图像大小?
- 2. 根据宽度调整图像大小
- 3. 在Java中调整图像大小以缩小图像大小
- 4. 在显示图像之前需要根据图像大小调整div大小
- 5. Google Python图像库 - 如何根据图像宽度调整图像大小?
- 6. Bootstrap - 是否可以根据列大小调整图像大小?
- 7. 根据图像大小调整div大小
- 8. 根据窗口大小调整图像大小
- 9. 根据图像大小调整文本大小
- 10. 根据内存大小调整图像大小
- 11. 根据图像大小调整大小的花式框
- 12. ImageView根据android中的图像大小动态调整大小
- 13. Excel根据图像大小调整单元格大小
- 14. 根据Android上的屏幕大小调整图像大小
- 15. 根据表格大小调整图像大小
- 16. 根据文字大小调整图像大小
- 17. 根据图像大小调整内容大小动态加载
- 18. 根据屏幕设备大小调整图像按钮大小
- 19. NSImageView调整大小与图像大小
- 20. 如何在调整图像大小时调整图像大小使用drawImage
- 21. 图像未调整大小
- 22. 调整jpeg图像大小?
- 23. codeigniter图像调整大小
- 24. Phalcon图像调整大小
- 25. JavaFx图像调整大小
- 26. ckfinder图像调整大小
- 27. 图像调整大小Codeigniter
- 28. 调整图像大小。 。 。 。
- 29. 图像调整大小Java
- 30. 调整图像大小
您可以更新自动布局约束编程的UIImageView的也可以是根据图像的尺寸以编程方式创建的UIImageView(添加为子视图)。 – nikhil84