I have a UIWebView that only cover majority of the right part of the screen.
To do this, I specify the frame size and position for portrait orientation using the frame property.
webView.frame=CGRectMake(220,100,548,875);
When the device is rotated to landscape, I specify a new frame for landscape orientation:
webView.frame=CGRectMake(300,73,724,638);
The problem is when I rotate the webView from portrait to landscape and to portrait again and i changed the frame to the original one, its width is only a half from before..
Here are my codes and function called to resize the frames:
-(void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
if(toInterfaceOrientation==UIInterfaceOrientationPortraitUpsideDown)
{
}
else if(self.interfaceOrientation==UIInterfaceOrientationPortrait)
{
[self showLandscape];
}
else if(toInterfaceOrientation==UIInterfaceOrientationPortrait)
{
[self showPortrait];
}
}
-(void)showLandscape
{
.
.
.
webView.frame=CGRectMake(300,73,724,638);
.
.
.
}
-(void)showPortrait
{
.
.
.
webView.frame=CGRectMake(220,100,548,875);
.
.
.
}
How to solve this problem?
webViewcreated dynamically? - holex