I am using the following to scale and reposition a UIView layer when the device rotates to landscape.
[containerView.layer setValue:[NSNumber numberWithFloat: 0] forKeyPath: @"transform.translation.x"];
[containerView.layer setValue:[NSNumber numberWithFloat: 0] forKeyPath: @"transform.translation.y"];
[containerView.layer setValue:[NSNumber numberWithFloat: 1] forKeyPath: @"transform.scale.x"]; //[NSNumber numberWithInt:1]
[containerView.layer setValue:[NSNumber numberWithFloat: 1] forKeyPath: @"transform.scale.y"];
and then the folowing when rotating back to portrait
[containerView.layer setValue:[NSNumber numberWithFloat: -75] forKeyPath: @"transform.translation.x"];
[containerView.layer setValue:[NSNumber numberWithFloat: 0] forKeyPath: @"transform.translation.y"];
[containerView.layer setValue:[NSNumber numberWithFloat: .7] forKeyPath: @"transform.scale.x"]; //[NSNumber numberWithInt:1]
[containerView.layer setValue:[NSNumber numberWithFloat: .7] forKeyPath: @"transform.scale.y"];
The problem is that after rotaing back to portrait, the layer is 'travelling' ie the x,y offset are gradually changing(increasing x, decreasing y). Scale seems fine (ie doesn't increment, decrement on repeated rotations)
Can anyone suggest a proper solution?