title: How to enlarge an UIImage to clear pixels without becoming blurry in iOS?
body: <p>I need to make an <code>UIImageView</code> supports zoom in/out, and the most important is, when an image is enlarged, it should been seen the clear and large pixels, but not the fuzzy processed effect, like the images below.</p>
  
  <p>It should be like that:</p>
  
  <p><img src="https://i.stack.imgur.com/JqhY5.png" alt="enter image description here"></p>
  
  <p>Should not be like that:</p>
  
  <p><img src="https://i.stack.imgur.com/jMznc.png" alt="enter image description here"></p>
  
  <p>My code, doesn't work:</p>
  
  <pre><code>- (void)viewDidLoad {
      [super viewDidLoad];
  
      self.view.backgroundColor = [UIColor whiteColor];
  
      imageView = [[ColorPickImageView alloc] initWithImage:self.image];
      imageView.contentMode = UIViewContentModeScaleAspectFit;
  
      [self addGestureRecognizerToView:imageView];
      [imageView setUserInteractionEnabled:YES];
      [imageView setMultipleTouchEnabled:YES];
  
      [self.view addSubview:imageView];
  
      [imageView setTranslatesAutoresizingMaskIntoConstraints:NO];
      NSDictionary *views = NSDictionaryOfVariableBindings(imageView);
      [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|-0-[imageView]-0-|" options:0 metrics:nil views:views]];
      [self.view addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-0-[imageView]-0-|" options:0 metrics:nil views:views]];
  }
  
  - (void)addGestureRecognizerToView:(UIView *)view
  {
      UIPinchGestureRecognizer *pinchGestureRecognizer = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchView:)];
      [view addGestureRecognizer:pinchGestureRecognizer];
  }
  
  - (void)pinchView:(UIPinchGestureRecognizer *)pinchGestureRecognizer
  {
      UIView *view = pinchGestureRecognizer.view;
      if (pinchGestureRecognizer.state == UIGestureRecognizerStateBegan || pinchGestureRecognizer.state == UIGestureRecognizerStateChanged) {
          view.transform = CGAffineTransformScale(view.transform, pinchGestureRecognizer.scale, pinchGestureRecognizer.scale);
          pinchGestureRecognizer.scale = 1;
      }
  }
  </code></pre>