0
我使用cell.imageView.image = [UIImage imageNamed:@"demoImg.png"];
在单元格上显示图像,但在此图像中未显示其实际尺寸。如何在不使用自定义单元的情况下在tableviewcell上显示实际图像大小?
这样的形象正显示出小,但实际的图像是不同的尺寸和更大的,但只有当我对细胞点击显示实际尺寸
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *cellIdentifier = @"cellIdentifier";
UITableViewCell *cell = [self.tableView dequeueReusableCellWithIdentifier:cellIdentifier];
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];
if(cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier];
}
if (self.content.count > 0){
NSDictionary *contentdata = self.content[indexPath.row];
NSString *title = contentdata[@"description"];
NSString *imageUrlString = contentdata[@"imageHref"];
// NSString *description = contentdata[@"title"];
cell.textLabel.text = [title isKindOfClass:[NSNull class]] ? @"" : title; //----- Title
cell.imageView.image = [UIImage imageNamed:@"demoImg.png"];
//cell.detailTextLabel.text = [description isKindOfClass:[NSNull class]] ? @"" : description; //----- Description
cell.contentView.layer.borderColor = [UIColor blackColor].CGColor;
cell.contentView.layer.borderWidth = 1.0;
我不认为这是可能的。带图像的默认单元格用于显示图标。 – GeneCode
你必须根据你的原始图像设置你的单元格的高度和宽度。 –
即使我把高度设置得更大,它不反映在图像上......只有当我点击单元格时它会变大 – sss