** 修改圖片透明度 <h1>**
** 參數(shù) 1:修改的透明度 參數(shù)2:需要修改的圖片 <h3>**
-(UIImage*)imageByApplyingAlpha:(CGFloat)alphaimage:(UIImage*)image
{
UIGraphicsBeginImageContextWithOptions(image.size,NO,0.0f);
CGContextRefctx =UIGraphicsGetCurrentContext();
CGRectarea =CGRectMake(0,0, image.size.width, image.size.height);
CGContextScaleCTM(ctx,1, -1);
CGContextTranslateCTM(ctx,0, -area.size.height);
CGContextSetBlendMode(ctx,kCGBlendModeMultiply);
CGContextSetAlpha(ctx, alpha);
CGContextDrawImage(ctx, area, image.CGImage);**
UIImage*newImage =UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
returnnewImage;
}
** 用此方法可以設(shè)置 navigationBar的 背景圖片的透明度**
最后編輯于 :
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者