Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Only changing X axis value

Tags:

ios

cgrect

Im aware I can change the position of my image view like this

myImageView.frame = CGRectMake(99, 34, 32, 32);

But how do I change just the x value leave the rest as they are? I realize this is a simple question but because I don't know how to word the search Im having difficulty finding a solution. Thanks

like image 720
4GetFullOf Avatar asked Aug 15 '26 11:08

4GetFullOf


1 Answers

//capture frame
CGRect thisRect = myImageView.frame;

//modify required frame parameter (.origin.x/y, .size.width/height)
thisRect.origin.x = 0;

//set modified frame to object
[myImageView setFrame:thisRect];
like image 68
staticVoidMan Avatar answered Aug 17 '26 01:08

staticVoidMan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!