Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios5 具有容器控制器和UINavigationController的UIViewController层次结构中出现意外UIView偏移_Ios5_Uiview_Uiviewcontroller - Fatal编程技术网

Ios5 具有容器控制器和UINavigationController的UIViewController层次结构中出现意外UIView偏移

Ios5 具有容器控制器和UINavigationController的UIViewController层次结构中出现意外UIView偏移,ios5,uiview,uiviewcontroller,Ios5,Uiview,Uiviewcontroller,我有一个UINavigationController和许多子视图控制器,其中一些是容器控制器。上次添加的子UIViewController的UIView框架布局(绿色背景)在不应显示的情况下显示其父背景(黄色) 如何布局所有内容,使所有视图都在导航栏下方的屏幕范围内,而不出现奇怪的偏移 UIViewController层次结构,在my AppDelegate中启动: UINavigationController rootViewController:FrontFacadeViewControl

我有一个UINavigationController和许多子视图控制器,其中一些是容器控制器。上次添加的子UIViewController的UIView框架布局(绿色背景)在不应显示的情况下显示其父背景(黄色)

如何布局所有内容,使所有视图都在导航栏下方的屏幕范围内,而不出现奇怪的偏移

UIViewController层次结构,在my AppDelegate中启动:

UINavigationController rootViewController:FrontFacadeViewController < UIViewController
    view (0,0) dim:(320x460)

    => StandardCoverViewController < UIViewController
    added as addSubview of FrontFacadeViewController's view]    
    view: (0,0) dim:(320x460)       

        => ConfigurationViewController < UIViewController
        added by pushing onto self.navigationController
        view: (0,20) (320x460)

            => GearViewController < UIViewController
            added as subview of ConfigurationViewController's view 
            view: (0,0) (320x416)
FrontFacadeViewController:

// FrontFacadeViewController determines a particular view controller to present 
// based on some business logic.
// Because of this, it adds child UIViewControllers using container controllers.
//
- (void)viewDidLoad {
    StandardCoverViewController *controller = [StandardCoverViewController alloc] initWithNibName:nil bundle:self.nibBundle];

    [self addChildViewController:controller];
    [controller didMoveToParentViewController:self];    
    [self.view addSubview:controller.view];    
    [controller didMoveToParentViewController:self];    
}

- (IBAction)onButtonPress {
    ConfigurationViewController *controller = [[ConfigurationViewController alloc] initWithNibName:nil bundle:self.nibBundle];
    [self.navigationController pushViewController:controller animated:YES];        
}   
ConfigurationViewController:(黄色背景)

GearViewController:(绿色背景)


我做错了吗?

确实发生在我身上,但我不记得我做了什么来修复它=(如果你记得,那会很有帮助。
// FrontFacadeViewController determines a particular view controller to present 
// based on some business logic.
// Because of this, it adds child UIViewControllers using container controllers.
//
- (void)viewDidLoad {
    StandardCoverViewController *controller = [StandardCoverViewController alloc] initWithNibName:nil bundle:self.nibBundle];

    [self addChildViewController:controller];
    [controller didMoveToParentViewController:self];    
    [self.view addSubview:controller.view];    
    [controller didMoveToParentViewController:self];    
}

- (IBAction)onButtonPress {
    ConfigurationViewController *controller = [[ConfigurationViewController alloc] initWithNibName:nil bundle:self.nibBundle];
    [self.navigationController pushViewController:controller animated:YES];        
}   
- (void)viewDidLoad {
    [self.view setBackgroundColor:[UIColor yellowColor]];
    GearViewController *controller = [[GearViewController alloc] initWithNibName:nil bundle:self.nibBundle];
    [self addChildViewController:controller];
    [self.view addSubview:controller.view];
    [controller didMoveToParentViewController:self];    
}
- (void)viewDidLoad {
    [self.view setBackgroundColor:[UIColor greenColor]];
    // nothing special
}