ios7 - Why doesn't work a view controller at landscape when I show it? -


i add uiviewcontroller on main screen code :

settingviewcontroller *v=[ self.storyboard instantiateviewcontrollerwithidentifier: @"settingviewcontroller"];  [self addchildviewcontroller:v]; [self.view addsubview:v.view]; [v didmovetoparentviewcontroller:self]; 

my problem: presented view doesn't work @ landscape!! why??

enter image description here

you can add constraints programmatically on view controller (settingvc):

// pure auto layout approach settingvc.view.translatesautoresizingmaskintoconstraints=no;  // add constraints  nslayoutconstraint *leftconstraint = [nslayoutconstraint constraintwithitem:settingvc.view  attribute:nslayoutattributeleading                                                                                   relatedby:0                                                                                      toitem:self.view                                                                                   attribute:nslayoutattributeleft                                                                                  multiplier:1.0                                                                                    constant:0]; [self.view addconstraint:leftconstraint];  nslayoutconstraint *rightconstraint = [nslayoutconstraint constraintwithitem:settingvc.view                                                                                    attribute:nslayoutattributetrailing                                                                                    relatedby:0                                                                                       toitem:self.view                                                                                    attribute:nslayoutattributeright                                                                                   multiplier:1.0                                                                                     constant:0]; [self.view addconstraint:rightconstraint];  nslayoutconstraint *bottomconstraint = [nslayoutconstraint constraintwithitem:v.view  attribute:nslayoutattributebottom                                                                                   relatedby:0                                                                                      toitem:self.view                                                                                   attribute:nslayoutattributebottom                                                                                  multiplier:1.0                                                                                    constant:0]; [self.view addconstraint:bottomconstraint];                  nslayoutconstraint *topconstraint = [nslayoutconstraint constraintwithitem:settingvc.view                                                                                    attribute:nslayoutattributetop     relatedby:0                                                                      attribute:nslayoutattributetop     multiplier:1.0     constant:0];     [self.view addconstraint:topconstraint]; 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -