iphone - UIView changes width after switching orientation to landscape? -
i got uiview 2 subviews. uiview set uiviewautoresizingflexiblewidth. when enters layoutsubviews resizes frames of subviews relative uiview so:
rect.size.width = self.frame.size.width - rect.origin.x - textlabel.frame.origin.x;
but problem occurs in landscape mode cause in portrait mode self.frame.size.width (and bounds matter) respond 768 @ start , 788 after it's done rotating. meaning when rotates seems add 20pixels assume status bar.
when hard code 768 works expected. don't want of course. store initial state var , use don't think that's right way it.
anyone have solution?
greetings,
in application have been facing same problem. solve used didrotatefrominterfaceorientation:
method resize view when device rotated.self.view.frame = cgrectmake(0,0,self.view.bounds.size.width,self.view.bounds.size.height);
hope help.
Comments
Post a Comment