View won't go in front of parent view

68 views Asked by At

Basically I have a view that I make a subview of a separate view that I am using as a container the first view however won't go in front of its parent. On the storyboard is shows the child view in front of its parent however on the simulator it is behind.

EDIT - Sorry for the lack of detail let me clarify a bit

This is my XIB I named it SectionCard very basic only containing a single view with a black background enter image description here This is my storyboard all I have done is change the background to red I have added my SectionCard (which I set to clear color) and a basic view as the child of my section card I have set the color of which to pink

enter image description here So I thought when I run it I would get my red background a black rectangle with a smaller pink rectangle inside it however for some reason I get this-

enter image description here Initially I thought that the pink rectangle view was simply invisible however after commenting the view.frame = self.bounds line and shrinking the SectionCard in the XIB file I noticed that the SectionCard was actually covering up the pink view

enter image description here Hopefully this helped explain my issue in more depth any help is appreciated!!!

1

There are 1 answers

0
dahiya_boy On

Forcefully bring the view in front like below:

[outerView.view bringSubviewToFront: interview.view]