我想将我的targetView放在标签栏上方。我用targetLabel和cancelButton创建了XIB-File。
[我试图以编程方式将targetView放置在标签栏的顶部,但我想不出如何在它们之间没有空格的情况下进行操作。
[self addOverlayView:self.targetView x:0 y:self.view.frame.size.height - self.targetView.frame.size.height - 10];
addOverview是我制作的用于将视图放置在所需位置的功能:
- (void)addOverlayView:(UIView*)v x:(CGFloat)x y:(CGFloat)y
{
v.hidden = YES;
CGRect vFrame = v.frame;
vFrame.origin.x = x;
vFrame.origin.y = y;
if ((v.autoresizingMask & UIViewAutoresizingFlexibleWidth) != 0) {
vFrame.size.width = topView.bounds.size.width;
}
v.frame = vFrame;
[v.layer setTransform:CATransform3DMakeTranslation(0, 0, OVERLAY_TRANSLATION_Z)];
[overlayView addSubview:v];
}
我不知道这是否是正确的方法,但是(到目前为止)它对我有用。
为了使我的[[targetView恰好位于我的[[tabBar顶部,我需要进行哪些更改?
[self addOverlayView:self.targetView x:0 y:self.view.frame.size.height - self.targetView.frame.size.height];