I'm trying to change my UIView's frame with value I get from CMMotionManager and its method - startDeviceMotionUpdatesToQueue:withHandler
I wrote a draft like this :
[_motionManager startDeviceMotionUpdatesToQueue:theQueue withHandler:^(CMDeviceMotion *motion, NSError *error) {
CGRect frame = _backgroundView.frame;
double x = motion.attitude.roll;
frame.origin.x = x*10;
[_backgroundView setFrame:frame];
}];
But my view doesn't move at all. If I log my frame I can see changes at every update ... So why my view isn't moving on screen ?
Are you using Storyboard? The problem may be due to constraints set up in Storyboard overriding the frame change.
Change the auto-layout constraints via code and then try your frame change above.
To force change, you can use - (void)setNeedsLayout method after frame changes.