我正在以编程方式显示UIImageViews
。它适用于第一个UIView
,但是当我尝试在较小的view
上显示它时,它不会调整大小。
你能帮助我吗。提前致谢
顺便说一句,我有一个名为UIView
的{{1}}自定义类。我将这个类用于两个courtView
UIView
答案 0 :(得分:0)
试试这段代码
UIImage *myImage = [UIImage imageNamed :@"myImage.extension"];
//if ur images are static, if your images are from an array then loop it out write the below inside the loop, make sure myImageView is a class,static component.
CGFloat height = myImage.size.height;
CGFloat width = myImage.size.width;
myImageView.frame = CGRectMake (myImageView.frame.origin.x,myImageView.frame.origin.y,height,width);
myImageView.image = myImage;
希望这有帮助