Reputation: 4173
I am trying to place a UIButton
inbetween my popup view
and the parent view
.
I cant successfully do that by doing that [self.view addSubview:new];
. My problem there is the border UIView
can be seen across the UIButton
.
I've tried [self.view.superview addSubview:new];
thinking that that would make it go away but it doesnt it still shows there.
I need to find a way to successfully place that button on top of everything (UIView
border in this case).
I know I could do that if I insert the button from the parentView
, but I want to handle all my subViews
buttons within each subView
, otherwise it everything will become messy very quickly.
Is there a way to do what I am trying to achieve?
Upvotes: 1
Views: 235
Reputation: 195
According to Apple's CALayer documentation, borders always appear above subviews because they're drawn on another layer. The best solution is to create a background view to fake the border.
So instead, your popup view
would have an orange background. It'd have another, slightly smaller subview directly over it with a white background, and then your button.
See this post for the implementation.
Upvotes: 3