I have a problem with changing the position of a UIButton, created in Interface Builder. I have an Outlet to it in one of my classes. Now I need to change the position of this button according to a User Default, saved in standard User defaults. The problem is, that the button's position won't change after calling this code:
self.planButton.center = CGPointMake(244, 234);
I have already tried to call [self.planButton setNeedsDisplay]
I have also tried to call [self.view reloadInputViews]
with no effect.
Thanks for your help
You should use setFrame
[self.planButton setFrame:CGRectMake(244, 234, self.planButton.frame.size.width, self.planButton.frame.size.height)];
EDIT:
try this
self.view.autoresizesSubviews = NO;
If that doesn't work, You might want to do this in
(void)viewDidLayoutSubviews
instead of viewDidLoad
or viewDidAppear