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?
if you use autolayout,the call setFrame have no use,try call setTranslatesAutoresizingMaskIntoConstraints before setFrame
problem fixed by setting
self.view.autoresizesSubviews = NO;
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With