IOS - Custom table cell not full width UITableView

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

#import <UIKit/UIKit.h> @interface ProfileCustomCell : UITableViewCell { } @property (nonatomic, strong) IBOutlet UILabel *nameLabel; @property (nonatomic, strong) IBOutlet UIImageView *profileImageView; @end 

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]; 

enter image description here

+7
ios objective-c uitableview autolayout
source share
3 answers

Can you post the code please.

Have you turned on Use Auto Layout and Use Dimension Classes , as shown below, as shown below, both in a table and as a table. And tell me your problem

enter image description here

1) After that, select an image and a label and do as shown below

enter image description here

2) Select an image and do below

enter image description here

3) select the label and do the following

enter image description here

You can check the link below:

Table cell contents (title) moving left after cell selection

+2
source share

Instead of "filling in", automatic layout constraints to the leading and ending spaces to constant 0 and make sure that they do not apply to fields.

+1
source share

select your cellular inspector in the form of a table and check if you are connected by editing AccessoryView by mistake

enter image description here

+1
source share

All Articles