Curnelious
Curnelious

Reputation: 1

Container View will not properly load view

I have a container view,inside a view controller, with auto layout and Xcode6 . It is stretched on the full screen size in storyboard. This container view , just have to load another view controller .

I set a new view controller, with background green in storyboard . I set the constrains of the container in the first view to be :(i checked,he does not have other constrains)

Editor->pin
leading/trailing to superview
top/bottom to superview 

I am than loading to it a view with :

  UIViewController *con =[self.storyboard instantiateViewControllerWithIdentifier:@"r"];
    [self.containerView addSubview:con.view];

What happens , is that it always load the view controller in half of its screen, for every device on simulator. i just can't figure out why i dont see the green on full screen. I have started a new project, i created new controller. nothing.

See image:enter image description here

EDIT: I have set the background of the container to be yellow , so i can see now instead of the black on the image- a yellow colour that means he is there, but the view is not loaded to its centre.

Upvotes: 0

Views: 145

Answers (1)

Curnelious
Curnelious

Reputation: 1

Solved finally !

I had to set the view controller position before adding it to the container :

self.collection.view.frame=self.containerView.bounds;

Upvotes: 1

Related Questions