Note that there are some explanatory texts on larger screens.

plurals
  1. POUITableViewCell and disappearing separator
    primarykey
    data
    text
    <p>I try to implement my own simple style of cells in my UITableView and I have a problem with separator. Works great with normal view, but when i select a cell it disappears. I try to add to my customSelect view separator, but then I can't see the separator anywhere. How can I add a separator to selected cell? </p> <pre><code>- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *MyCellIdentifier = @"MyCellIdentifier"; UITableViewCell *cell = [wallMenuTableView dequeueReusableCellWithIdentifier:MyCellIdentifier]; if(cell == nil) { cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyCellIdentifier]; MenuItemModel *mItem = [menu.menuPositions objectAtIndex:indexPath.row]; cell.textLabel.text = mItem.displayName; cell.textLabel.textColor = [UIColor colorWithRed:0.70 green:0.70 blue:0.70 alpha:1.0]; cell.textLabel.backgroundColor = [UIColor clearColor]; cell.textLabel.font = [UIFont fontWithName:@"ArialMT" size:16]; cell.textLabel.shadowColor = [UIColor blackColor]; cell.textLabel.shadowOffset = CGSizeMake(0.0, 1.0); customSeparator = [[UIView alloc] initWithFrame:CGRectMake(0, (cell.frame.origin.y), 320, 2)]; customSeparator.backgroundColor=[UIColor blackColor]; [customSeparator.layer setShadowOffset:CGSizeMake(0.0, 0.8)]; [customSeparator.layer setShadowOpacity:0.8]; [customSeparator.layer setShadowRadius:0.8]; [customSeparator.layer setShadowColor:[UIColor grayColor].CGColor]; [cell.contentView addSubview:customSeparator]; customSelect = [[UIView alloc] initWithFrame:CGRectMake(0, (cell.frame.origin.y+2), cell.frame.size.width, cell.frame.size.height)]; //[customSelect addSubview:customSeparator]; customSelect.backgroundColor = [UIColor clearColor]; [cell setSelectedBackgroundView:customSelect]; } return cell; } </code></pre> <p>And current result:</p> <p><img src="https://i.stack.imgur.com/mDGBI.jpg" alt="enter image description here"></p>
    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.
 

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