I am using a view in main ViewController, and want to move it in a new position with a button click. I have already tried to use different method...
.h file
@property (nonatomic, strong) IBOutlet UIView *UIview3;
.m file
@synthesize UIview3;
and I have implemented the following methods.
Method: 1
CGRect f = self.UIview3.frame;
f.origin.x = 28; // new x
f.origin.y = 74; // new y
self.UIview3.frame = f;
Method: 2
UIView *newview = [[UIView alloc]initWithFrame:
CGRectMake(28, 74, 261, 119)];
[self.UIview3 addSubview:newview];
other methods (Non of this work)
UIview3.frame = CGRectMake(28, 231, 261, 119);
UIview3.center = CGPointMake( 28,74);
[_UIview3 setFrame:CGRectMake(28, 74, 261, 119)];
[_UIview3 setFrame:CGPointMake( 28,74)];
[self.UIview3 setCenter:CGPointMake(28, 74)];
Anyone to help ? Thanks in Advance. sohanoor