詳解IOSUITableViewCell的imageView大小更改

詳解IOS UITableViewCell 的 imageView大小更改

創(chuàng)新互聯(lián)專業(yè)為企業(yè)提供烏拉特前網(wǎng)站建設、烏拉特前做網(wǎng)站、烏拉特前網(wǎng)站設計、烏拉特前網(wǎng)站制作等企業(yè)網(wǎng)站建設、網(wǎng)頁設計與制作、烏拉特前企業(yè)網(wǎng)站模板建站服務,十載烏拉特前做網(wǎng)站經(jīng)驗,不只是建網(wǎng)站,更提供有價值的思路和整體網(wǎng)絡服務。

實例代碼:

- (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 開發(fā)的文章,歡迎大家搜索參閱,

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

當前題目:詳解IOSUITableViewCell的imageView大小更改
本文路徑:http://bm7419.com/article24/jjceje.html

成都網(wǎng)站建設公司_創(chuàng)新互聯(lián),為您提供標簽優(yōu)化、網(wǎng)站營銷建站公司、外貿(mào)建站搜索引擎優(yōu)化、網(wǎng)頁設計公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

手機網(wǎng)站建設