ios - obj-c nib loaded doesn't follow constraint -


i have 1 view controller : mainviewcontroller

inside mainviewcontroller, add uiview , set constraints (0,0,0,0) means same size super view.

from added uiview above, set custom class uiview file, lets called xmainview

here xmainview code

//xmainview.h @interface xmainview : uiview // properties here @end  //xmainview.m - (id)initwithframe:(cgrect)arect { if ((self = [super initwithframe:arect])) {     [self commoninit]; } return self; }  - (id)initwithcoder:(nscoder*)coder { if ((self = [super initwithcoder:coder])) {     [self commoninit]; } return self; }  - (void)commoninit{  uiview *mapview = [[[nsbundle mainbundle] loadnibnamed:@"xmapview"                                                  owner:self                                                options:nil] objectatindex:0];  mapview.frame = self.bounds; mapview.autoresizingmask = uiviewautoresizingflexiblewidth |  uiviewautoresizingflexibleheight;  [self addsubview: mapview]; }  - (void) loadmap:(nsarray *)results { self.passedresults = results;  [self commoninit]; [self updateusercurrentlocation]; [self zoomingtodevice]; } 

in xmapview.xib (storyboard) add ui view set bottom of view. put constraint of view follow :

trailing : 0 bottom : 0 leading : 0 height : 300 

in mainviewcontroller, how call xmainview

//the mapstoreview view mainviewcontroller. outlet , name mapstoreview - (void)viewdidload { [super viewdidload]; [self.mapstoreview loadmap:nil]; } // have tried put in viewwillappear, viewdidappear, same results 

iphone 7+ iphone 5

however, view xmapview seems go bottom off screen. put constraint well. weirdest part is, runs okay using iphone 7plus. other device, have bottom offset screen problem.

i have been looking hints quite while , cant find any. frustates me. maybe know problem?

thanks


Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -