【发布时间】:2013-03-07 14:38:00
【问题描述】:
我有一个UIView,我用以下方式定义它的边界:
self.layer.borderColor = [UIColor blackColor].CGColor;
self.layer.borderWidth = 3;
我在这个UIView 上附加了一个子视图,当我将子视图移到边框上时,它会移到它的下方。这是预期的行为吗?有没有办法让子视图在它上面?
【问题讨论】:
-
苹果文档说
The border is drawn inset from the receiver’s bounds by the value specified in this property. It is composited above the receiver’s contents and sublayers所以边框在你所有层的顶部(包括你的子层) -
好提示@郭陆川!也许使用背景图像覆盖另一个 UIView
-
@aăâ 是的,你是对的,让背景视图假装边框可以处理。也许其他人有一个完美的方法来处理它。而且我们也想过有没有完美的方法
标签: iphone ios cocoa-touch uiview calayer