Note that there are some explanatory texts on larger screens.

plurals
  1. POtableview cell unable to load two tableviews
    primarykey
    data
    text
    <p>I have to two table view in my view if i am load only one table view it is working fine. But when i am trying to load both table view using below method it is giving below exception.</p> <p>uncaught exception 'NSRangeException', reason: '<em>*</em> -[NSArray objectAtIndex:]: index 2 beyond bounds [0 .. 1]'</p> <pre><code>- (void)viewDidLoad { [super viewDidLoad]; array1 = [[NSArray alloc]initWithObjects:@"Start",@"End",@"Frequency",@"Time of Day",nil]; array2 =[[NSArray alloc]initWithObjects:@"Alarm",@"Tone",nil]; table1.scrollEnabled =NO; table2.scrollEnabled =NO; </code></pre> <p>}</p> <pre><code>- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { if (tableView == table1) ; return 1; if (tableView == table2); return 1; </code></pre> <p>}</p> <pre><code>- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { if (tableView == self.table1) ; return [array1 count]; if (tableView == self.table2) ; return [array2 count]; </code></pre> <p>}</p> <pre><code>- (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] autorelease]; } // Configure the cell... if (tableView == self.table1){ cell.textLabel.text = [array1 objectAtIndex:indexPath.row]; } if (tableView == self.table2){ cell.textLabel.text = [array2 objectAtIndex:indexPath.row]; } return cell;} </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload