How to move UIButton programmatically. Objective-C Xcode
.h file
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController{
IBOutlet UIButton *theButton;
}
@property(nonatomic, strong) IBOutlet UIButton *theButton;
-(IBAction)moveTheButton:(id)sender;
@end
.m file
-(IBAction)moveTheButton:(id)sender{
CGRect btFrame = theButton.frame;
btFrame.origin.x = 90;
btFrame.origin.y = 150;
theButton.frame = btFrame;
}
This code moves the button from one point to another.
Simply uncheck "Use Autolayout" in the file inspector..