我尝试在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) 我已经为 UITextField 层设置了一个自定义边框。当 UITextField 获得焦点时,视图会变大。但该层没有放大。因此在视图中间绘制了边框我做错了什么?