Ответ 1
Вы можете добавить subview к вашему UIImageView
, содержащему другое изображение, с маленьким заполненным треугольником. Или вы можете нарисовать внутри первого изображения:
CGFloat width, height;
UIImage *inputImage; // input image to be composited over new image as example
// create a new bitmap image context at the device resolution (retina/non-retina)
UIGraphicsBeginImageContextWithOptions(CGSizeMake(width, height), YES, 0.0);
// get context
CGContextRef context = UIGraphicsGetCurrentContext();
// push context to make it current
// (need to do this manually because we are not drawing in a UIView)
UIGraphicsPushContext(context);
// drawing code comes here- look at CGContext reference
// for available operations
// this example draws the inputImage into the context
[inputImage drawInRect:CGRectMake(0, 0, width, height)];
// pop context
UIGraphicsPopContext();
// get a UIImage from the image context- enjoy!!!
UIImage *outputImage = UIGraphicsGetImageFromCurrentImageContext();
// clean up drawing environment
UIGraphicsEndImageContext();
Этот код (источник здесь) создаст новый UIImage
, который вы можете использовать для инициализации UIImageView
.