File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
Sources/InAppSettingsKit/Views Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -16,15 +16,18 @@ - (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reus
1616 self.datePicker = [[IASKDatePicker alloc ] init ];
1717
1818 self.contentView .preservesSuperviewLayoutMargins = YES ;
19- [self .contentView addSubview: self .textLabel];
2019 [self .contentView addSubview: self .datePicker];
2120
22- [self .contentView addConstraints: [NSLayoutConstraint constraintsWithVisualFormat: @" |-[label]-(>=16)-[picker(50@100)]-|" options: 0 metrics: nil views: @{@" label" : self.textLabel , @" picker" : self.datePicker }]];
21+ NSMutableDictionary *views = @{@" picker" : self.datePicker }.mutableCopy ;
22+ if (self.textLabel ) {
23+ views[@" label" ] = self.textLabel ;
24+ }
25+ [self .contentView addConstraints: [NSLayoutConstraint constraintsWithVisualFormat: @" |-[label]-(>=16)-[picker(50@100)]-|" options: 0 metrics: nil views: views]];
2326 [self .textLabel setContentCompressionResistancePriority: UILayoutPriorityDefaultLow forAxis: UILayoutConstraintAxisHorizontal];
2427 [self .datePicker setContentCompressionResistancePriority: UILayoutPriorityRequired forAxis: UILayoutConstraintAxisHorizontal];
2528
2629 [self .contentView addConstraints: [NSLayoutConstraint constraintsWithVisualFormat: @" V:|-4-[picker]-4-|" options: 0 metrics: nil views: @{@" picker" : self.datePicker }]];
27- [self .contentView addConstraints: [NSLayoutConstraint constraintsWithVisualFormat: @" V:|-4-[label]-4-|" options: 0 metrics: nil views: @{ @" label " : self. textLabel } ]];
30+ [self .contentView addConstraints: [NSLayoutConstraint constraintsWithVisualFormat: @" V:|-4-[label]-4-|" options: 0 metrics: nil views: views ]];
2831 self.textLabel .translatesAutoresizingMaskIntoConstraints = NO ;
2932 self.datePicker .translatesAutoresizingMaskIntoConstraints = NO ;
3033 }
You can’t perform that action at this time.
0 commit comments