UIImageView aspect fit and center

前端 未结 10 979
执笔经年
执笔经年 2020-12-07 09:48

I have an image view, declared programmatically, and I am setting its image, also programmatically.

However, I find myself unable to set the image to both fit the as

10条回答
  •  天命终不由人
    2020-12-07 10:30

    let bannerImageView = UIImageView();
    bannerImageView.contentMode = .ScaleAspectFit;
    bannerImageView.frame = CGRectMake(cftX, cftY, ViewWidth, scrollHeight);
    

提交回复
热议问题