我在一个单独的xib文件中有一个弹出视图。视图背景为0.5 alpha,中间只有一个正方形。
当我实例化它并使用父视图对其进行addSubView
时,它可以正常工作,但子视图不会显示在navigationBar
之上。当我这样做时,但使用父导航控制器的视图,它只显示0.5 alpha背景,而不是正方形。
换句话说:
// Works fine, but doesn't show itself above the NavigationBar
GDSubCategoryPopupViewController *subCategoryPopupView = [[GDSubCategoryPopupViewController alloc] init];
[self.view addSubview:subCategoryPopupView.view];
// Shows itself above the navigationBar, but only display the transparent background
GDSubCategoryPopupViewController *subCategoryPopupView = [[GDSubCategoryPopupViewController alloc] init];
[self.navigationController.view addSubview:subCategoryPopupView.view];
我错过了什么吗?
答案 0 :(得分:0)
尝试以这种方式实例化GDSubCategoryPopupViewController
GDSubCategoryPopupViewController *subCategoryPopupView = [[GDSubCategoryPopupViewController alloc] initWithNibName:@"nibname" bundle:nil];