Note that there are some explanatory texts on larger screens.

plurals
  1. POUITableView first page of cells are not shown
    primarykey
    data
    text
    <p>I inherited an old iPhone app that I'm converting from NIBs to a storyboard. One thing that I can't seem to figure out is that the first page of cells in a UITableView is covered by the background color. I've verified that the cells are being created and being filled out. But I just can't see them. Once I scroll down, the lower cells look fine.</p> <p>TableView code:</p> <pre><code>- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section { return segment_SECTION_HEIGHT; } - (CGFloat) tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath { return segment_CELL_HEIGHT; } - (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView { NSArray * allKeys = [segmentsByTimeDictionary allKeys]; return allKeys.count; } - (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section { NSString *date = [timeSections objectAtIndex: section]; NSMutableArray *timesegments = [segmentsByTimeDictionary objectForKey: date]; return timesegments.count; } - (UIView *)tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section { NSString *date = [timeSections objectAtIndex: section]; UIView *headerView = [[GradientView alloc] initWithStartColor: segment_SECTION_COLOR_TOP endColor: segment_SECTION_COLOR_BOTTOM]; headerView.frame = CGRectMake(0, 0, tableView.frame.size.width, segment_SECTION_HEIGHT); UILabel *timeLabel = [[UILabel alloc] initWithFrame: CGRectMake(10, 0, 320, segment_SECTION_HEIGHT)]; timeLabel.backgroundColor = [UIColor clearColor]; timeLabel.font = [UIFont boldSystemFontOfSize: 16]; timeLabel.text = date; timeLabel.textColor = segment_SECTION_TEXT_COLOR; [headerView addSubview: timeLabel]; return headerView; // return date; } - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"segmentCell"; segmentCell *cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier]; NSDate *date = [timeSections objectAtIndex: indexPath.section]; NSMutableArray *timesegments = [segmentsByTimeDictionary objectForKey: date]; segments *segment = [timesegments objectAtIndex: indexPath.row]; [cell setName: segment.name]; return cell; } </code></pre> <p>Edited to add: I noticed if I remove this function call from viewDidLoad, then it goes away:</p> <pre><code>drawGradientBackground(self.view, DEFAULT_BACKGROUND_TOP, DEFAULT_BACKGROUND_BOTTOM); </code></pre> <p>That function is defined as </p> <pre><code>CAGradientLayer *gradient = [CAGradientLayer layer]; gradient.colors = [NSArray arrayWithObjects: (id) startColor.CGColor, (id) endColor.CGColor, nil]; gradient.frame = view.layer.bounds; [view.layer insertSublayer: gradient atIndex: 0]; </code></pre> <p>Screenshot: <img src="https://i.stack.imgur.com/cc0m7.png" alt="UITableView Screenshot"></p>
    singulars
    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.
 

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