我提出這樣一個UIWebView(情況2):UIWebView的交換機不改變方向爲橫向
- (void)actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
CGRect frame = CGRectMake(0, 0, 320, 400);
SongDetailsTVC *infoVC;
UIWebView *ytView;
NSString *htmlVideoHTML, *html;
UIViewController *youtubeController;
switch (buttonIndex) {
case 0:
[self swapLanguage];
break;
case 1:
infoVC = [[SongDetailsTVC alloc] initWithStyle:UITableViewStyleGrouped];
[infoVC setSongData:songData];
[infoVC setTitle:@"Song Info"];
[[self navigationController] pushViewController:infoVC animated:YES];
[infoVC release];
break;
case 2:
// HTML to embed YouTube video
htmlVideoHTML = @"<html><head>\
<body style=\"margin:0\">\
<embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
width=\"%0.0f\" height=\"%0.0f\"></embed>\
</body></html>";
// Populate HTML with the URL and requested frame size
html = [NSString stringWithFormat:htmlVideoHTML, [songData objectForKey:@"YouTube Link (Value)"], frame.size.width, frame.size.height];
// Load the html into the webview
ytView = [[UIWebView alloc] initWithFrame:frame];
[ytView setMediaPlaybackRequiresUserAction:NO];
[ytView loadHTMLString:html baseURL:nil];
youtubeController = [[UIViewController alloc] init];
[youtubeController setView:ytView];
[youtubeController setTitle:@"YouTube Video"];
[[self navigationController] pushViewController:youtubeController animated:YES];
[ytView release];
[youtubeController release];
break;
default:
break;
}
}
的問題是,當我切換到橫向模式,它不會改變其方向。我究竟做錯了什麼?謝謝。