I'm making an scrollview within a view of the iPad. It should switch positions after rotating. It works however when I rotate my device twice the scroller gets out of my screen.
Think I'm making a mistake with my angle calculations. However i saw the following on the UIView CLass reverence about the transform property " if this property is not the identity transform, the value of the frame property is undefined and therefor should be ignored"
However I still can't figure it out. Some help would be realy appreciated.
Code:
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
if(interfaceOrientation == UIInterfaceOrientationLandscapeLeft ||
interfaceOrientation == UIInterfaceOrientationLandscapeRight){
interfaceOrientation == UIInterfaceOrientationLandscapeLeft;
backgroundImage.image = [UIImage imageNamed:@"landscape.png"];
scroller.transform = CGAffineTransformMakeRotation(M_PI/2);
scroller.frame = CGRectMake(0, 108, 130, 750);
scroller.contentSize = CGSizeMake(1040, 130);
scroller.scrollEnabled = YES;
}
if(interfaceOrientation == UIInterfaceOrientationPortrait ||
interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown){
interfaceOrientation == UIInterfaceOrientationPortrait;
backgroundImage.image = [UIImage imageNamed:@"portrait.png"];
scroller.transform = CGAffineTransformMakeRotation(M_PI*2);
scroller.frame = CGRectMake(0, 870, 768, 128);
scroller.contentSize = CGSizeMake(940, 128);
}
Think I'm making a mistake with my angle calculations. However i saw the following on the UIView CLass reverence about the transform property " if this property is not the identity transform, the value of the frame property is undefined and therefor should be ignored"
However I still can't figure it out. Some help would be realy appreciated.
Last edited by a moderator: