Note that there are some explanatory texts on larger screens.

plurals
  1. POTalbeView cell showing null value
    primarykey
    data
    text
    <p>I have created a custom table for the <code>rootViewController</code> of a split view application so that the selected row expands and shows as a sub-table (showing main menu and sub menu ). The first row of the sub-table should show the particular main menu item of the sub-table.I'm fetching the main menu items from another class.</p> <p>The problem is that the first row for the sub table is showing blank for me.Using NSLog, I checked the value of variable just before assigning it to the cell and even after assigning the value to the cell, i checked the text value in the cell using <code>cell.textLabel.text</code>. I'm getting the value in the console every time, but the row is still blank!!! </p> <p>Row is showing the value if I'm hard coding it with any value!!!</p> <p>Note:<code>TableView</code> is showing values for remaining rows.</p> <p>Anybody can help me?? Thanks in advance...and sorry for my poor English.. </p> <p>EDIT: In the <code>rootViewController</code>:</p> <pre><code>(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { tableView.separatorColor=[UIColor grayColor]; if (sectionopen[indexPath.row]) { accordianTable *cell1; cell1=(accordianTable *)[tableView dequeueReusableCellWithIdentifier:@"cell1"]; if (cell1 == nil) { cell1 = [[[accordianTable alloc] initWithFrame:CGRectZero reuseIdentifier:@"cell1"] autorelease]; } cell1.selectionStyle=UITableViewCellSelectionStyleNone; return cell1; } else { //tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine; static NSString *CellIdentifier = @"CellIdentifier"; // Dequeue or create a cell of the appropriate type. UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease]; cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator; cell.selectionStyle = UITableViewCellSelectionStyleGray; } // Configure the cell. cell.textLabel.text=[UIAppDelegate.mainMenu objectAtIndex:indexPath.row]; return cell; } } (void)tableView:(UITableView *)aTableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { accordianTable *acc = [[accordianTable alloc]init]; acc.titl=[UIAppDelegate.mainMenu objectAtIndex:indexPath.row]; [acc.subTable reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationFade]; ///turn them all off sectionopen[0]=NO; sectionopen[1]=NO; sectionopen[2]=NO; sectionopen[3]=NO; ///open this one sectionopen[indexPath.row]=YES; ///animate the opening and expand the row [self.tableView reloadSections:[NSIndexSet indexSetWithIndex:0] withRowAnimation:UITableViewRowAnimationFade]; UIViewController *localdetailViewController = nil; } </code></pre> <p>In the custom cell class (accordianTable):</p> <pre><code>(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { // Number of rows is the number of time zones in the region for the specified section. return [UIAppDelegate.subMenu count]+1;//including title and sub menu } (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *MyIdentifier = @"MyIdentifier"; UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier]; if (cell == nil) { cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier] autorelease]; } switch (indexPath.row) { case 0: NSLog(@"text is &gt;&gt; %@",titl); cell.textLabel.text=titl; NSLog(@"text is &gt;&gt; %@",cell.textLabel.text); cell.textLabel.textColor=[UIColor whiteColor]; cell.contentView.backgroundColor=[UIColor blackColor]; cell.textLabel.backgroundColor=[UIColor blackColor]; cell.selectionStyle=UITableViewCellSelectionStyleNone; break; default: int Row=indexPath.row; Row--; cell.textLabel.text=[UIAppDelegate.subMenu objectAtIndex:Row]; cell.textLabel.textColor=[UIColor orangeColor]; cell.textLabel.textAlignment=UITextAlignmentCenter; cell.selectionStyle=UITableViewCellSelectionStyleNone; break; } return cell; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    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