簡體   English   中英

UITableViewCell中的UIImageView調整為行高

[英]UIImageView in UITableViewCell resizes to row height

我有一個UITableViewCell,並且正在使用它的UIImageView,並且我設置了UIImageView的大小為25,25。 問題是,當我點擊單元格時,圖像大小會調整為行高,這不是我想要的。 我希望它能保持在25,25。 這可能嗎? 這是我的代碼:

  cell.imageView.bounds = CGRectMake(cell.imageView.origin.x, cell.imageView.origin.y, 25, 25);
        cell.imageView.frame = cell.imageView.bounds;
        cell.imageView.autoresizingMask = UIViewAutoresizingNone;
        cell.imageView.clipsToBounds = YES;
        cell.imageView.layer.borderWidth = 0;
        cell.imageView.layer.borderColor = [UIColor blackColor].CGColor;

是的,可以,但是您必須通過子類UITableViewCell創建自己的UITableViewCell並添加具有固定大小的UIImageView

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM