-1

I have this picture:

I have this picture

I want to add UIImageViews as subviews and I want images to be "crooked" with background.

I think i must use kCGBlendModeMultiply.

Any ideas how to solve this issue?

Paul R
  • 208,748
  • 37
  • 389
  • 560
Munadel
  • 107
  • 2
  • 12
  • 2
    Please add some clarification. I think you want the images to appear as if they were printed on the paper, and thus compressed and twisted by its folds, but that's not really possible (or at least very hard), because to do that you would have to infer the 3D shape of the paper, and all you have is 2D data. – Graham Asher Nov 24 '15 at 18:52
  • Yes exactly if I add an image on somewhere it must be merged with this paper like it printed on it – Munadel Nov 24 '15 at 19:06

1 Answers1

1

You can create a subclass of UIView and override drawRect.

For example, I created a subclass named CrinkedView. The .h looks like this:

#import <UIKit/UIKit.h>
IB_DESIGNABLE
@interface CrinkedView : UIView
@property (nonatomic, strong) IBInspectable UIImage *crinkedImage;
@end

And the .m like this:

#import "CrinkedView.h"

@implementation CrinkedView

-(void)setCrinkedImage:(UIImage *)crinkedImage
{
    _crinkedImage = crinkedImage;
    [self setNeedsDisplay];
}


- (void)drawRect:(CGRect)rect {
    [[UIImage imageNamed:@"vI745.jpg"] drawInRect:self.bounds];
    if (self.crinkedImage) {
        [self.crinkedImage drawInRect:self.bounds blendMode:kCGBlendModeMultiply alpha:1.0];
    }

}


@end
beyowulf
  • 15,101
  • 2
  • 34
  • 40