RELATEED CONSULTING
相关咨询
选择下列产品马上在线沟通
服务时间:8:30-17:00
你可能遇到了下面的问题
关闭右侧工具栏

新闻中心

这里有您想知道的互联网营销解决方案
详解IOSUITableViewCell的imageView大小更改

详解IOS UITableViewCell 的 imageView大小更改

创新互联专业为企业提供乌拉特前网站建设、乌拉特前做网站、乌拉特前网站设计、乌拉特前网站制作等企业网站建设、网页设计与制作、乌拉特前企业网站模板建站服务,十载乌拉特前做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。

实例代码:

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{

  static NSString *CellIdentifier = @"Cell";

  UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

  if(cell == nil){
    cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:CellIdentifier];
    cell.textLabel.text = [self.arrStr objectAtIndex:indexPath.row];

    UIImage *img = [UIImage imageNamed:[self.arrImg objectAtIndex:indexPath.row]];
    cell.imageView.image = img;

    //iOS UITableViewCell 的 imageView大小更改
    CGSize itemSize = CGSizeMake(img.size.width *2/3, img.size.height *2/3);
    UIGraphicsBeginImageContext(itemSize);
    CGRect imageRect = CGRectMake(0.0, 0.0, itemSize.width, itemSize.height);
    [cell.imageView.image drawInRect:imageRect];
    cell.imageView.image = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
  }
  return cell;


}

以上就是关于IOS UITableViewCell 的 imageView大小更改的实例,本站还有很多关于IOS 开发的文章,欢迎大家搜索参阅,

感谢阅读,希望能帮助到大家,谢谢大家对本站的支持!


文章名称:详解IOSUITableViewCell的imageView大小更改
本文地址:http://sczitong.cn/article/jjceje.html