The SubView's background is lost

My application's structure is as follow:

  • UITabViewController:

  • First UIViewController:

  • UIPageViewController:

    - Page1: UIViewController:
    
                - UIView: contains Some UILabels, 1 UIButton
    
    - Page2: UIViewController:
    
                - UIView: contains Some UILabels, 1 UIButton
    
  • Second UIViewController:

  • The UIView I added programmatically in the UIViewController:

    - (void)viewDidLoad {
        [super viewDidLoad];
        // Do any additional setup after loading the view.
    
        SessionView* b = [[[NSBundle mainBundle] loadNibNamed:@"SessionView" owner:self options:nil] lastObject];
        CGRect frame = b.frame;
    
        b.frame = CGRectMake(0, 88, frame.size.width, frame.size.height);
    
        [self.view addSubview:b];
    }
    
    

    The weird thing is the UIView appears without its background color. And the button cannot be tapped.

    缺少背景

    I upload the source code here just in case you want to check.

    I am working on iOS8, XCode6, iPad

    Thanks a lot.


    尝试这个 :

      [mainview bringSubviewToFront:subview];
    

    图像如下

    tick mark a subview clip...............

    链接地址: http://www.djcxy.com/p/87762.html

    上一篇: 子视图不可见

    下一篇: SubView的背景丢失了