如何在ios中为可调整大小的图像设置缩放属性的值?
- (IBAction)changeToLdpi:(id)sender
{
myImage= [myImage resizableImageWithCapInsets:UIEdgeInsetsMake(50, 150,50,150) resizingMode:UIImageResizingModeStretch];
//self.scale=2.0;
CIImage *scaledImg=[[CIImage alloc]initWithImage:myImage];
myImage=[UIImage imageWithCIImage:scaledImg scale:2.0 orientation:UIImageOrientationLeft];
[self->imageView setImage:myImage];
//[_view addSubview:imageView];
}
我使用过这段代码。 但规模:2.0不起作用。 建议我怎么做?
答案 0 :(得分:0)
使用此方法可行
myImage= [myImage resizableImageWithCapInsets:UIEdgeInsetsMake(50, 150,50,150)];
UIImage *picture = [UIImage imageWithCGImage:[myImage CGImage] scale:2.0 orientation:UIImageOrientationLeft];