title: How to add UIImageView on popup block in ios
body: <p>Hi I am very new to iOS and in my project iI have created one <code>UITableView</code> with images as like my below screen ok that's fine</p>
  
  <p>And here when I tapped on tableView images I want show that related row images with popup block using one <code>UIView</code>.</p>
  
  <p>But using my code image is not showing on popup <code>UIView</code>. Please see my below screen image is not adding on <code>UIView</code> popup block please help me some one.</p>
  
  <h1>My Code:</h1>
  
  <pre><code>#import "imageTableViewController.h"
  
  @interface imageTableViewController ()&lt;UITableViewDataSource,UITableViewDelegate&gt;
  {
      UITableView *mainTable;
      NSMutableArray *imageArray;
      UIButton *imageButton;
      UIView *popUpView;
      BOOL isFullScreen;
      CGRect prevFrame;
  }
  
  @end
  
  @implementation imageTableViewController
  
  - (void)viewDidLoad {
      [super viewDidLoad];
  
      imageArray = [[NSMutableArray alloc] initWithObjects:@"flower.jpeg",@"Bird.jpg",@"Browser.jpeg", nil];
      mainTable = [[UITableView alloc] initWithFrame:CGRectMake(0, 20, 320, 480)];
      mainTable.dataSource = self;
      mainTable.delegate = self;
      [self.view addSubview:mainTable];
  
      popUpView = [[UIView alloc] initWithFrame:CGRectMake(30, 30, 25, 25)];
      popUpView.backgroundColor = [UIColor orangeColor];
      popUpView.transform = CGAffineTransformScale(CGAffineTransformIdentity, 0.001, 0.001);
      [mainTable addSubview:popUpView];
  
      UIImageView * imageView = [[UIImageView alloc] initWithFrame:CGRectMake(5, 5, 20, 20)];
      imageView.image = [UIImage imageNamed:@"flower.jpeg"];
      [popUpView addSubview:imageView];
  
  }
  
  -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
  {
      return imageArray.count;
  }
  -(UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      static NSString *CellIdentifier = @"cell";
      UITableViewCell *Cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
      if (Cell == nil)
      {
          Cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier];
  
      }
      imageButton = [[UIButton alloc] initWithFrame:CGRectMake(10, 10, 50, 50)];
      [imageButton setImage:[UIImage imageNamed:[imageArray objectAtIndex:indexPath.row]] forState:UIControlStateNormal];
      [imageButton addTarget:self action:@selector(imgToFullScreen:) forControlEvents:UIControlEventTouchUpInside];
      [Cell.contentView addSubview:imageButton];
  
  
      return Cell;
  }
  -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      return 60;
  }
  
  -(void)imgToFullScreen:(UITapGestureRecognizer*)sender {
      if (!isFullScreen) {
          [UIView animateWithDuration:0.5 delay:0 options:0 animations:^{
              popUpView.hidden = NO;
              prevFrame = CGRectMake(30, 30, 25, 25);
              [popUpView setFrame:CGRectMake(120, 50, 150, 150)];
          }completion:^(BOOL finished){
              isFullScreen = TRUE;
          }];
          return;
      }
      else{
          [UIView animateWithDuration:0.5 delay:0 options:0 animations:^{
              [popUpView setFrame:prevFrame];
  
          }completion:^(BOOL finished){
              isFullScreen = FALSE;
              popUpView.hidden = YES;
          }];
          return;
      }
  }
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/KHIWK.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/KHIWK.png" alt="enter image description here"></a></p>