我尝试在UIImage上得到圆角,到目前为止我读到的,最简单的方法是使用蒙版图像.为此我使用了TheElements iPhone Example中的代码和我找到的一些图像大小调整代码.我的问题是resizedImage总是为nil而且我没有找到错误...
- (UIImage *)imageByScalingProportionallyToSize:(CGSize)targetSize
{
CGSize imageSize = [self size];
float width = imageSize.width;
float height = imageSize.height;
// scaleFactor will be the fraction that we'll
// use to adjust the size. For example, if we shrink
// an image by half, scaleFactor will be 0.5. the
// scaledWidth and scaledHeight will be the original,
// multiplied by the scaleFactor.
//
// IMPORTANT: the "targetHeight" is the size of the space
// we're drawing into. The "scaledHeight" is …Run Code Online (Sandbox Code Playgroud)