title: assigning datasource to two tableviews in one view controller
body: <p>Whats wrong in the following code?
  here i am using two table views and assigning them with different data source, but its not working</p>
  
  <pre><code>-(void)viewDidLoad
  {
      [super viewDidLoad];
  
      arryData = [[NSArray alloc] initWithObjects:@"MCA",@"MBA",@"BTech",@"MTech",nil];
      arryData2 = [[NSArray alloc] initWithObjects:@"Objective C",@"C++",@"C#",@".net",nil];
  
      flag=1;
      myTable1.hidden=YES;
      myTable2.hidden=YES;
      btnOne.layer.cornerRadius=8;
      btnTwo.layer.cornerRadius=8;
      myTable1.layer.cornerRadius=8;
      myTable2.layer.cornerRadius=8;
      myTable1.delegate=self;
      myTable1.dataSource=self;
      myTable2.delegate=self;
      myTable2.dataSource=self;
  }
  
  -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView 
  {
      return 1;
  }
  
  -(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section     
  {
      if(self.myTable1=tableView)
      {
          return [arryData count];     
      }
      else {
          return [arryData2 count];
      }
  }
  
  -(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
  {
      return 20;
  }
  
  -(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath 
  {    
      if(tableView==self.myTable1)
      {
          static NSString *CellIdentifier1 = @"Cell1";
  
          UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier1];
          if (cell == nil) 
          {
              cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier1] ;
          }
  
          cell.textLabel.text = [arryData objectAtIndex:indexPath.row];
          NSLog(@"1here is%i  %@",indexPath.row,cell.textLabel.text);
           return cell;
      }
      else 
      {
          static NSString *CellIdentifier2 = @"Cell2";
  
          UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier2];
          if (cell == nil) 
         {
              cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier2] ;
          }
  
          cell.textLabel.text = [arryData2 objectAtIndex:indexPath.row];         
           return cell;
      }
  }
  
  
  -(IBAction)btnCategory:(id)sender 
  {
      if (flag==1) {
          flag=0;
          myTable1.hidden=NO;
          myTable2.hidden=YES;
  
      }
      else{
          flag=1;
          myTable1.hidden=YES;
          myTable2.hidden=YES;
  
      }
  }
  
  -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
  {
      myTable1.hidden=YES;
      myTable2.hidden=YES;
  }
  
  -(IBAction)btnTopic:(id)sender 
  {
      if (flag==1) {
          flag=0;
          myTable2.hidden=NO;
          myTable1.hidden=YES;    
      }
      else{
          flag=1;
          myTable2.hidden=YES;
          myTable1.hidden=YES;
  
      }    
  }
  &lt;/code&gt;
  </code></pre>
  
  <p>when i remove datasource of mytable2 all data gets added to table1 else nothing gets loaded in none of the table.</p>