I have some widgets defined in an XIB, I want to set the constrains-anchors programatically. When I set an imageView seems to work, but a UITable is disappearing when left, right or bottom anchors are set.
Also the table is not setting Y position underneath the imageView...
- (void)viewDidLayoutSubviews{
[super viewDidLayoutSubviews];
[self setupConstrains];
}
- (void)setupConstrains {
// //image world
self.whatDoppelsView.translatesAutoresizingMaskIntoConstraints = false;
[self.whatDoppelsView.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor].active = YES;
[self.whatDoppelsView.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor].active = YES;
//table,
self.table.translatesAutoresizingMaskIntoConstraints = false;
//
[self.table.topAnchor constraintEqualToAnchor:self.whatDoppelsView.bottomAnchor constant:0];
//
// [self.table.topAnchor constraintEqualToAnchor:self.view.topAnchor constant:1];
//
// //[self.table.heightAnchor constraintEqualToConstant:900];
//
[self.table.heightAnchor constraintEqualToAnchor:self.view.heightAnchor multiplier:0.50];
// [self.table.leadingAnchor constraintEqualToAnchor:self.view.leadingAnchor].active = YES;
// [self.table.trailingAnchor constraintEqualToAnchor:self.view.trailingAnchor].active = YES;
// [self.table.bottomAnchor constraintEqualToAnchor: self.view.bottomAnchor].active = YES;
}
If i uncomment the table leading, trailing or bottom anchor, it disappears, also the table should be underneath my imageView.
How to fix this layout?, thanks!