title: TableView Row unable to Select
body: <p>I defined my own controller with no nib file like this:</p>
  
  <pre><code>@interface EngineViewController : UIViewController &lt;UITableViewDelegate, UITableViewDataSource&gt; {
      EngineViewProperties* viewProp;
      UIImageView *imgView; // image view of selected engine
      NSUInteger selectedIndex;
      UITableView *menu;
  }
  
  @property (nonatomic,retain) EngineViewProperties* viewProp;
  
  - (EngineViewController *) initWithEngineViewProperties: (EngineViewProperties *) _viewProp;
  
  - (void) dropdownMenu: (id) sender;
  </code></pre>
  
  <p>I created my view in loadView,with three subviews. The subview arrowBtn is helped to popup a list of search engines.</p>
  
  <pre><code>- (void)loadView {
      // ...
      UIButton *arrowBtn = [[UIButton alloc] initWithFrame:rect];
      [arrowBtn setImage:viewProp.arrowImg forState:UIControlStateNormal];
  
      [arrowBtn addTarget:self action:@selector(dropdownMenu:) forControlEvents:UIControlEventTouchUpInside];
  
      [self.view addSubview:imgView];
      [self.view addSubview:label];
      [self.view addSubview:arrowBtn];
      // ...
  }
  </code></pre>
  
  <p>I create a table listing search engines in the selector dropdownMenu:</p>
  
  <pre><code>- (void) dropdownMenu: (id) sender {
      UIButton *arrowBtn = (UIButton *)sender;
      // ...
      menu = [[UITableView alloc] initWithFrame:rect style:UITableViewStylePlain];
      menu.delegate = self;
      menu.dataSource = self;
      menu.backgroundColor = [UIColor blackColor];
      menu.allowsSelection = YES;
      [self.view addSubview:menu];
      [self.view bringSubviewToFront:menu];
      [menu release];
  }
  </code></pre>
  
  <p>And I implemented </p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
  </code></pre>
  
  <p>as usual.
  But the result is that the menu popup happily,but I can do nothing with the cells.I clicked the cells,but no response.Those methods like "didSelectRowAtIndexPath" can not be called.
  Sorry to paste up so much codes one time.But I really need help.I don't know what is the problem.Please forgive me for my poor English and low development skill in Iphone.And thanks a lot if you give me a little suggestions.</p>
  
  <p>//Added-------------------------</p>
  
  <p>"numberOfRowsInSection" is simple:</p>
  
  <pre><code>- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
      return [viewProp.txtArray count];
  }
  </code></pre>
  
  <p>and another method:</p>
  
  <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
      static NSString *MenuItems = @"MenuItems";
      UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MenuItems];
      if (cell == nil) {
              cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier: MenuItems] autorelease];
      }
      NSUInteger row = [indexPath row];
  
      cell.imageView.image = [viewProp.imgArray objectAtIndex:row];
      cell.textLabel.text = [viewProp.txtArray objectAtIndex:row];
      cell.textLabel.textColor = [UIColor whiteColor];
      cell.textLabel.font = [UIFont systemFontOfSize:12.0];
      cell.selectionStyle = UITableViewCellSelectionStyleNone; // Blue style tried,helpless too
      if (row == selectedIndex) {
              cell.selected = YES;
      }
      cell.userInteractionEnabled = YES;
      return cell;
  }
  </code></pre>
  
  <p>// Added</p>
  
  <p>Strangely,when the menu firstly poped up,the default selected cell was highlighted correctly,but very quickly the highlighting disappeard.</p>