I've been using the following code to move views around, and never had a problem. I started using ARC in my project for the first time and I am getting the following error on the second line. "Read-only variable is not assignable"
Am I suppose to do this differently with ARC?
CGRect rect = self.frame;
[UIView animateWithDuration:0.4 animations:^{
rect.origin.x = 57;
self.frame = rect;
}];
The problem was that I was using the CGRect inside an animation block. Marking the variable with __block solved my problem
__block CGRect rect = self.frame;
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