title: UIMenuController method setTargetRect:inView: not working in UITableView
body: <p>I am displaying custom <code>UIMenuController</code> in my <code>tableview</code> like this </p>
  
  <p><img src="https://i.stack.imgur.com/yQKL4.png" alt="enter image description here"></p>
  
  <p>but issue is that it is displaying in the center I want to display it on top of <code>label</code> which is orange colored. For displaying on top of <code>label</code> I did this <code>[menu setTargetRect:CGRectMake(10, 10, 0, 0) inView:self.lbl];</code> below is the entire code.</p>
  
  <p>But if I am displaying the <code>UIMenuController</code> without <code>UITableView</code> <code>setTargetRect</code> works fine.</p>
  
  <p>Why <code>setTargetRect</code> is not working with <code>UITableView</code>?</p>
  
  <p><strong>setTargetRect Doc says:</strong></p>
  
  <blockquote>
    <p>(a) This target rectangle (targetRect) is usually the bounding rectangle
    of a selection. UIMenuController positions the editing menu above this
    rectangle; if there is not enough space for the menu there, it
    positions it below the rectangle. The menu’s pointer is placed at the
    center of the top or bottom of the target rectangle as appropriate.</p>
    
    <p>(b) Note that if you make the width or height of the target rectangle
    zero, UIMenuController treats the target area as a line or point for
    positioning (for example, an insertion caret or a single point).</p>
    
    <p>(c) Once it is set, the target rectangle does not track the view; if the
    view moves (such as would happen in a scroll view), you must update
    the target rectangle accordingly.</p>
  </blockquote>
  
  <p>What I am missing?</p>
  
  <p><strong>MyViewController</strong></p>
  
  <pre><code>-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
      return 5;
  }
  
  -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
      TheCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cid" forIndexPath:indexPath];
  
      cell.lbl.text = [NSString stringWithFormat:@"%ld", (long)indexPath.row];
  
      return cell;
  }
  
  - (BOOL)tableView:(UITableView *)tableView shouldShowMenuForRowAtIndexPath:(NSIndexPath *)indexPath {
      return YES;
  }
  
  -(BOOL)tableView:(UITableView *)tableView canPerformAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender {
      return YES;
  }
  
  - (void)tableView:(UITableView *)tableView performAction:(SEL)action forRowAtIndexPath:(NSIndexPath *)indexPath withSender:(id)sender {
      // required
  }
  </code></pre>
  
  <p><strong>MyCustomCell</strong></p>
  
  <pre><code>- (void)awakeFromNib {
      // Initialization code
  
      UIMenuItem *testMenuItem = [[UIMenuItem alloc] initWithTitle:@"Test" action:@selector(test:)];
      UIMenuController *menu = [UIMenuController sharedMenuController];
      [menu setMenuItems: @[testMenuItem]];
  
      [menu setTargetRect:CGRectMake(10, 10, 0, 0) inView:self.lbl];
  
      [menu update];
  }
  
  - (void)setSelected:(BOOL)selected animated:(BOOL)animated {
      [super setSelected:selected animated:animated];
  
      // Configure the view for the selected state
  }
  
  -(BOOL) canPerformAction:(SEL)action withSender:(id)sender {
      return (action == @selector(copy:) || action == @selector(test:));
  }
  
  /// this methods will be called for the cell menu items
  -(void) test: (id) sender {
      NSLog(@"test");
  }
  
  -(void) copy:(id)sender {
      UIMenuController *m = sender;
      NSLog(@"copy");
  }
  </code></pre>