欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

詳解IOS UITableViewCell 的 imageView大小更改

 更新時間:2017年07月19日 09:08:29   作者:追到夢的魔術(shù)師  
這篇文章主要介紹了詳解IOS UITableViewCell 的 imageView大小更改的相關(guān)資料,需要的朋友可以參考下

詳解IOS UITableViewCell 的 imageView大小更改

實(shí)例代碼:

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


}

以上就是關(guān)于IOS UITableViewCell 的 imageView大小更改的實(shí)例,本站還有很多關(guān)于IOS 開發(fā)的文章,歡迎大家搜索參閱,

感謝閱讀,希望能幫助到大家,謝謝大家對本站的支持!

相關(guān)文章

最新評論