ios - autoresize mask is making width of view to 0 -
in following code see if set autoresize mask of redview
uiviewautoresizingflexiblewidth|uiviewautoresizingflexibleheight
width of view made 0 after rotate screen.
but if make uiviewautoresizingflexiblewidth|uiviewautoresizingflexibleheight|uiviewautoresizingflexiblebottommargin|uiviewautoresizingflexiblerightmargin
, behavior expected, view width , height scaled in proportion width , height of new screen.
why isn't setting flexibleheight , width not enough?
uiview *redview = [[uiview alloc] initwithframe:cgrectmake(50, 50, 100, 150)]; redview.backgroundcolor = [uicolor redcolor]; //this makes width 0 after rotation //redview.autoresizingmask = uiviewautoresizingflexiblewidth|uiviewautoresizingflexibleheight; //this works redview.autoresizingmask = uiviewautoresizingflexiblewidth|uiviewautoresizingflexibleheight|uiviewautoresizingflexiblebottommargin|uiviewautoresizingflexiblerightmargin; [self.view addsubview:redview];
Comments
Post a Comment