UIImageView change Width and Height

后端 未结 8 825
-上瘾入骨i
-上瘾入骨i 2021-02-13 10:12

I\'ve read various posts on here asking similar questions... I\'ve tried various ways that were posted including bounds and frames etc. including the following:



        
8条回答
  •  猫巷女王i
    2021-02-13 11:13

    The following will change the size of the UIImaveView, clipping the underlying image without resizing it and keeping it aligned to bottom left of view:

    imageView.frame = CGRectMake(
                 imageView.frame.origin.x, 
                 imageView.frame.origin.y, newWidth, newHeight);
    
    imageView.contentMode = UIViewContentModeBottomLeft; // This determines position of image
    imageView.clipsToBounds = YES;
    

提交回复
热议问题