Maybe I'm wrong. So I created a UITableView, which essentially has a finite auto layout space set to the main view. I create a custom cell for this table, so I use it in the prototype, set it up and create a class for myself. It all works great.
What I can not solve is a custom cell that does not go over the full width of the actual table cell, so a white background just appears. If I do not use a custom cell, the entire width table cell will be used.
I set limits on the contents of the cell so that the background image fills the cell.
What am I doing wrong? Let me know what you need to help solve this problem.
ProfileCustomCell.h
ProfileCustomCell.m
#import "ProfileCustomCell.h" @implementation ProfileCustomCell - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.nameLabel.text = nil; } return self; } - (void)setSelected:(BOOL)selected animated:(BOOL)animated { [super setSelected:selected animated:animated]; } @end
UITableView
[tableView registerNib:[UINib nibWithNibName:@"ProfileCustomCell" bundle:[NSBundle mainBundle]] forCellReuseIdentifier:@"Cell"]; [tableView setSeparatorStyle:UITableViewCellSeparatorStyleNone]; ProfileCustomCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier]; cell.nameLabel.text = [NSString stringWithFormat:@"%@", [child objectForKey:@"first_name"]]; [cell setSelectionStyle:UITableViewCellSelectionStyleNone];

ios objective-c uitableview autolayout
Josh york
source share