title: How to create UIButton in UIImageView's top left corner and bottom right corner
body: <p>I wish to create delete button in imageview's top left corner and bottom right corner. but it doesn't look like what I needed.</p>
  
  <p><img src="https://i.stack.imgur.com/XPG6s.png" alt="enter image description here"></p>
  
  <p>I wish both the buttons should be placed on corner of the <strong>Red border</strong></p>
  
  <p>To create the button I used the code below</p>
  
  <pre><code>   UIImageView * tappedView = (UIImageView *)[recognizer view];
  
  [tappedView.layer setBorderColor: [[UIColor redColor] CGColor]];
  [tappedView.layer setBorderWidth: 2.0];
  tappedView.layer.cornerRadius = 10;
  tappedView.layer.masksToBounds = NO;
  
  
  UIButton *deleteBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  deleteBtn.frame = CGRectMake(0, 0, 20, 20);
  
  [deleteBtn setImage:[UIImage imageNamed:@"close.png"]forState:UIControlStateNormal];
  
  deleteBtn.layer.shadowColor = [[UIColor blackColor] CGColor];
  deleteBtn.layer.shadowOffset = CGSizeMake(0,4);
  deleteBtn.layer.shadowOpacity = 0.3;
  [tappedView addSubview:deleteBtn];
  [deleteBtn addTarget:self action:@selector(deleteProperties:) forControlEvents:UIControlEventTouchUpInside];
  
  
  
  UIButton *zoomBtn = [UIButton buttonWithType:UIButtonTypeCustom];
  zoomBtn.frame = CGRectMake(tappedView.frame.size.width, tappedView.frame.size.height, 20, 20);
  
  [zoomBtn setImage:[UIImage imageNamed:@"close.png"]forState:UIControlStateNormal];
  
  zoomBtn.layer.shadowColor = [[UIColor blackColor] CGColor];
  zoomBtn.layer.shadowOffset = CGSizeMake(0,4);
  zoomBtn.layer.shadowOpacity = 0.3;
  [tappedView addSubview:zoomBtn];
  [zoomBtn addTarget:self action:@selector(ZoomIn:) forControlEvents:UIControlEventTouchUpInside];
  </code></pre>
  
  <p>please guide me.</p>
  
  <p>I want like this<img src="https://i.stack.imgur.com/PPSWy.png" alt="enter image description here"></p>