我有一个UINavigationBar子类,我正在添加一些UIViews。
我的UIViews根据我在NSDictionary *views, *metrics;
// search container constraints
[self addSubview:self.searchContainer];
self.searchContainer.translatesAutoresizingMaskIntoConstraints = NO;
views = NSDictionaryOfVariableBindings(_searchContainer);
metrics = @{@"h": @(SearchContainerExpandedHeight) };
self.searchContainerLeftSpacingConstraint = [NSLayoutConstraint constraintWithItem:self.searchContainer attribute:NSLayoutAttributeLeft relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeLeft multiplier:1.0 constant:xMargin];
[self addConstraint:self.searchContainerLeftSpacingConstraint];
self.searchContainerRightSpacingConstraint = [NSLayoutConstraint constraintWithItem:self.searchContainer attribute:NSLayoutAttributeRight relatedBy:NSLayoutRelationEqual toItem:self attribute:NSLayoutAttributeRight multiplier:1.0 constant: 0 - xMargin];
[self addConstraint:self.searchContainerRightSpacingConstraint];
[self addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"V:|-24-[_searchContainer(h)]" options:0 metrics:metrics views:views]];
//etc
Sub HTH()
Dim rCopy As Range
With Sheet1.AutoFilter.Range
'// Set to somewhere blank and unused on your worksheet
Set rCopy = Sheet1.Range("A" & Rows.Count - (.Rows.Count))
.SpecialCells(xlCellTypeVisible).Copy rCopy
End With
With rCopy.Offset(1).Resize(5) '// Offset to avoid the header
.Resize(, 2).Copy Sheet2.Range("A5")
.Offset(, 3).Resize(, 1).Copy Sheet2.Range("D5")
.Offset(, 5).Resize(, 1).Copy Sheet2.Range("F5")
.CurrentRegion.Delete xlUp '// Delete the tempory area
End With
Set rCopy = Nothing
End Sub
在iOS8及以上版本,这很好用。在iOS7上,我收到以下错误:
'执行-layoutSubviews后仍需要自动布局。 MyUINavigationBarSubclass&-outoutSubviews的实现需要调用super。'
是什么给出的?我没有在任何地方覆盖layoutSubviews吗?
PS。我在添加约束之前尝试调用[self layoutIfNeeded](正如其他人在其他问题中所建议的那样),但它似乎没有用。
答案 0 :(得分:0)
确保设置:
[containerView setTranslatesAutoresizingMaskIntoConstraints:NO];
表示您的容器和子视图。