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