如何设置UIImage的帧大小。
答案 0 :(得分:21)
您可以设置UIImageView
:
UIImageView* imgView = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 100, 100)];
imgView.image = [UIImage imageNamed:@"image.png"];
(不要忘记[imgView release];
某处)
答案 1 :(得分:6)
UIImage没有框架。它只有宽度和高度。如果你想把它放在你的视图上,你应该创建UIImageView
UIImageView *imageView = [[UIImageView alloc] initWithFrame:CGRectMake(12,12,123,123)];
imageView.image = image; // image - your UIImage