新网创想网站建设,新征程启航

为企业提供网站建设、域名注册、服务器等服务

详解IOSUITableViewCell的imageView大小更改-创新互联

详解IOS UITableViewCell 的 imageView大小更改

创新互联提供网站建设、成都网站设计、网页设计,成都品牌网站建设1元广告等致力于企业网站建设与公司网站制作,十载的网站开发和建站经验,助力企业信息化建设,成功案例突破1000+,是您实现网站建设的好选择.

实例代码:

- (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;


}

另外有需要云服务器可以了解下创新互联建站www.cdcxhl.com,海内外云服务器15元起步,三天无理由+7*72小时售后在线,公司持有idc许可证,提供“云服务器、裸金属服务器、高防服务器、香港服务器、美国服务器、虚拟主机、免备案服务器”等云主机租用服务以及企业上云的综合解决方案,具有“安全稳定、简单易用、服务可用性高、性价比高”等特点与优势,专为企业上云打造定制,能够满足用户丰富、多元化的应用场景需求。


网站题目:详解IOSUITableViewCell的imageView大小更改-创新互联
转载来于:http://www.wjwzjz.com/article/idopo.html
在线咨询
服务热线
服务热线:028-86922220
TOP