1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
{
    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    self.uiWebView.alpha = 0.0;
    [UIView commitAnimations];
    
    currentOrientation = toInterfaceOrientation;
    NSString *urlAddress = [[NSString alloc] init];
    if (UIInterfaceOrientationIsLandscape(currentOrientation) == YES) {
        urlAddress = [[NSBundle mainBundle] pathForResource:@"landscape" ofType:@"pdf"];
    }
    else {
        urlAddress = [[NSBundle mainBundle] pathForResource:@"portrait" ofType:@"pdf"];
    }

    NSURL *url = [NSURL fileURLWithPath:urlAddress];
    NSURLRequest *requestObj = [NSURLRequest requestWithURL:url];
    self.uiWebView.opaque = NO;
    self.uiWebView.backgroundColor = [UIColor clearColor];
    [self.uiWebView loadRequest:requestObj];

    [UIView beginAnimations:nil context:NULL];
    [UIView setAnimationDuration:1];
    self.uiWebView.alpha = 1.0;