UIView setFrame problem
19,460
Solution 1
problem fixed by setting
self.view.autoresizesSubviews = NO;
Solution 2
if you use autolayout,the call setFrame have no use,try call setTranslatesAutoresizingMaskIntoConstraints before setFrame
Comments
-
Nico AD almost 2 years
I must do something wrong, but dont know what..
I try to add a subView with this code:
subMenuView = [[UISubMenuViewMainController alloc] init]; [subMenuView.view setFrame:CGRectMake(10,0,990,100)]; subMenuView.view.backgroundColor = [UIColor whiteColor]; [self.view addSubview:subMenuView.view];
I want my view to be at (10,0) and have 990/100 in width/height
but i dont get the expected result
Let me if I m wrong, If I want a 10x10 square view at the center i have to add the following line:
[subMenuView.view setFrame:CGRectMake(512,384,10,10)];
That s not what I get, the position is correct, but the width/height are wrong, any ideas?