Note that there are some explanatory texts on larger screens.

plurals
  1. POiOS UITableViewCell adding label and image
    primarykey
    data
    text
    <p>I am trying to add text label or UIImage (does not matter) in UITableViewCell. But it did not appear. I am using few views in this cell. You can see it in the code below:</p> <pre><code> - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *CellIdentifier = @"timelineCell"; KMWTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier forIndexPath:indexPath]; if (cell) { cell = [cell initWithFrame:CGRectMake(13, 10, 293, 200)]; UIView *cellContentView = [[UIView alloc] initWithFrame:CGRectMake(13, 10, 293, 200)]; cellContentView.layer.cornerRadius = 5; cellContentView.layer.shadowOffset = CGSizeMake(1, 0); cellContentView.layer.shadowColor = [[UIColor blackColor] CGColor]; cellContentView.layer.shadowRadius = 5; cellContentView.layer.shadowOpacity = .25; cellContentView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"cellBack"]]; UIView *selectedContentView = [[UIView alloc] initWithFrame:CGRectMake(13, 10, 293, 200)]; selectedContentView.layer.cornerRadius = 5; selectedContentView.layer.shadowOffset = CGSizeMake(1, 0); selectedContentView.layer.shadowColor = [[UIColor blackColor] CGColor]; selectedContentView.layer.shadowRadius = 5; selectedContentView.layer.shadowOpacity = .25; selectedContentView.backgroundColor = [UIColor colorWithPatternImage:[UIImage imageNamed:@"cellBackActive"]]; UIView *visibleContentView = [[UIView alloc] initWithFrame:CGRectMake(13, 10, 293, 200)]; visibleContentView.layer.cornerRadius = 5; visibleContentView.layer.shadowOffset = CGSizeMake(1, 0); visibleContentView.layer.shadowColor = [[UIColor blackColor] CGColor]; visibleContentView.layer.shadowRadius = 5; visibleContentView.layer.shadowOpacity = .25; visibleContentView.backgroundColor = [UIColor clearColor]; //Image adding here: [ UIImageView *image = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"active.png"]]; [visibleContentView addSubview:image]; [cellContentView addSubview:visibleContentView]; [selectedContentView addSubview:visibleContentView]; [cell setBackgroundView:cellContentView]; [cell setSelectedBackgroundView:selectedContentView]; } return cell; } </code></pre> <p>As you can see I am using backgroundView and selectedBackgroundView and also view with other info with clearColor. So why other elements do not display in visibleView?</p> <p><strong>UPDATE:</strong></p> <p>I am using subclass because I need to change frame size of cell.</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.
    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