We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I am attempting to Display a UIImageView on the Left of the Title Label, however nothing shows could you lead me in the correct direction?
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier { self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]; if (self) { self.titleLabel = [UILabel newAutoLayoutView]; [self.titleLabel setLineBreakMode:NSLineBreakByTruncatingTail]; [self.titleLabel setNumberOfLines:1]; [self.titleLabel setTextAlignment:NSTextAlignmentLeft]; [self.titleLabel setTextColor:[UIColor blackColor]]; self.proImageView = [[UIImageView alloc] initWithFrame:CGRectZero]; self.proImageView.translatesAutoresizingMaskIntoConstraints = NO; self.proImageView.contentMode = UIViewContentModeScaleAspectFill; self.proImageView.backgroundColor = [UIColor blackColor]; self.bodyLabel = [UILabel newAutoLayoutView]; [self.bodyLabel setLineBreakMode:NSLineBreakByTruncatingTail]; [self.bodyLabel setNumberOfLines:0]; [self.bodyLabel setTextAlignment:NSTextAlignmentLeft]; [self.bodyLabel setTextColor:[UIColor darkGrayColor]]; [self.contentView addSubview:self.titleLabel]; [self.contentView addSubview:self.bodyLabel]; [self.contentView addSubview:self.proImageView]; [self updateFonts]; } return self; } - (void)updateConstraints { if (!self.didSetupConstraints) { // Note: if the constraints you add below require a larger cell size than the current size (which is likely to be the default size {320, 44}), you'll get an exception. // As a fix, you can temporarily increase the size of the cell's contentView so that this does not occur using code similar to the line below. // See here for further discussion: https://github.com/Alex311/TableCellWithAutoLayout/commit/bde387b27e33605eeac3465475d2f2ff9775f163#commitcomment-4633188 // self.contentView.bounds = CGRectMake(0.0f, 0.0f, 99999.0f, 99999.0f); [UIView autoSetPriority:UILayoutPriorityRequired forConstraints:^{ [self.titleLabel autoSetContentCompressionResistancePriorityForAxis:ALAxisVertical]; }]; [self.titleLabel autoPinEdgeToSuperviewEdge:ALEdgeTop withInset:kLabelVerticalInsets]; [self.titleLabel autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:kLabelHorizontalInsets]; [self.titleLabel autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:kLabelHorizontalInsets]; [self.proImageView autoPinEdge:ALEdgeRight toEdge:ALEdgeLeft ofView:self.titleLabel withOffset:kLabelHorizontalInsets]; [UIView autoSetPriority:UILayoutPriorityRequired forConstraints:^{ [self.proImageView autoSetContentCompressionResistancePriorityForAxis:ALAxisVertical]; }]; [self.proImageView autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:kLabelHorizontalInsets]; [self.proImageView autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:kLabelHorizontalInsets]; [self.proImageView autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:kLabelVerticalInsets]; [self.bodyLabel autoPinEdge:ALEdgeTop toEdge:ALEdgeBottom ofView:self.titleLabel withOffset:kLabelVerticalInsets]; [UIView autoSetPriority:UILayoutPriorityRequired forConstraints:^{ [self.bodyLabel autoSetContentCompressionResistancePriorityForAxis:ALAxisVertical]; }]; [self.bodyLabel autoPinEdgeToSuperviewEdge:ALEdgeLeading withInset:kLabelHorizontalInsets]; [self.bodyLabel autoPinEdgeToSuperviewEdge:ALEdgeTrailing withInset:kLabelHorizontalInsets]; [self.bodyLabel autoPinEdgeToSuperviewEdge:ALEdgeBottom withInset:kLabelVerticalInsets]; self.didSetupConstraints = YES; } [super updateConstraints]; }
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I am attempting to Display a UIImageView on the Left of the Title Label, however nothing shows could you lead me in the correct direction?
The text was updated successfully, but these errors were encountered: