UIImageView, setClipsToBounds and how my images are losing their head

后端 未结 2 1180
我在风中等你
我在风中等你 2021-01-02 03:58

I\'m developing an iOS 4 application.

I\'m using this code on an UIImageView on an UITableViewCell:

cell.photo.contentMode          


        
2条回答
  •  夕颜
    夕颜 (楼主)
    2021-01-02 05:01

    There is no built-in way to do this, but you can do it manually:

    UIGraphicsBeginImageContext(CGSizeMake(desiredWidth, desiredHeight));
    
    [originalImage drawAtPoint...];
    ...
    
    UIImage *scaledImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    

提交回复
热议问题