0

基本上我有一个视图,我创建了一个单独视图的子视图,我将其用作容器,但第一个视图不会出现在其父视图之前。在情节提要上,子视图显示在其父视图的前面,但在模拟器上它在后面。

编辑-抱歉缺少细节让我澄清一下

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!!!

4

1 回答 1

0

强制将视图放在前面,如下所示:

[outerView.view带来SubviewToFront:interview.view]

于 2017-01-07T04:34:06.990 回答