I get the visibleRect from an UIImageView inside a method, that is called several times to move that view to the right. As soon as it goes partly out of the screen, I expect that the visibleRect becomes smaller. But it does not.
-(IBAction)moveToRight:(id)sender {
CGRect frameRect = myUIImageView.frame; //that's an image I use in background of other views
CALayer *myLayer = [myUIImageView layer];
CGRect visRect = [myLayer visibleRect];
NSLog(@"%f, %f", visRect.origin.x, visRect.size.width); //width is always 300.0
CGPoint rectPoint = frameRect.origin;
CGFloat newXPos = rectPoint.x + 10.5f;
myUIImageView.frame = CGRectMake(newXPos, 0.0f, myUIImageView.frame.size.width, myUIImageView.frame.size.height);
}
is there something special I must think about, when I need the true visible Rectangle of an view? Actually I thought that it would be always clipped by the superview, so that method returns the true visible rectangle dimensions.
But as I move the UIImageView step by step to the right, it remains at 300.0 width. Even if a part of it goes out of the window.