// Setup a new context with the correct sizeCGfloat wIDth = 1000;CGfloat height = 1000;UIGraphicsBeginImageContextWithOptions(CGSizeMake(wIDth,height),NO,0.0); CGContextRef context = UIGraphicsGetCurrentContext(); UIGraphicsPushContext(context); // Now we can draw anything we want into this new context.CGPoint origin = CGPointMake((wIDth - oldImage.size.wIDth) / 2.0f,(height - oldImage.size.height) / 2.0f);[oldImage drawAtPoint:origin];// Clean up and get the new image.UIGraphicsPopContext(); UIImage *newImage = UIGraphicsGetimageFromCurrentimageContext();UIGraphicsEndImageContext();总结
以上是内存溢出为你收集整理的ios – 在UIImage周围添加透明空间全部内容,希望文章能够帮你解决ios – 在UIImage周围添加透明空间所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)