我正在尝试让我的 youtube 视频以横向模式播放。我关闭了左右横向以支持设备方向,因为如果它打开,每个视图都可以横向。我正在为 iOS 6 构建这个。如何让我的视频横向播放。
这是我的代码
#import "VideoTViewController.h"
#import "HCYoutubeParser.h"
#import <MediaPlayer/MediaPlayer.h>
@interface VideoTViewController ()
@end
@implementation VideoTViewController
@synthesize tLabel;
-(IBAction)playVideo
{
NSDictionary *videos = [HCYoutubeParser h264videosWithYoutubeURL:[NSURL URLWithString:@"http://www.youtube.com/watch?v=zz_bJ58LfCg&feature=youtu.be"]];
MPMoviePlayerViewController *mp = [[MPMoviePlayerViewController alloc] initWithContentURL:[NSURL URLWithString:[videos objectForKey:@"medium"]]];
[self presentViewController:mp animated:YES completion:nil];
}
编辑:
我做了以下事情:
开了一个新班
AboutNavViewController(它是 UiNavigationController 的子类)
#import "AboutNavViewController.h"
@interface AboutNavViewController ()
@end
@implementation AboutNavViewController
- (BOOL)shouldAutorotate {
return NO;
}
- (BOOL)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
@end
在我的 aboutviewcontroller (子类化 uiviewcontroller)
#import "AboutViewController.h"
#import "AboutNavViewController.h"
@interface AboutViewController ()
@end
@implementation AboutViewController
@synthesize aLabel;
- (void)viewDidLoad
{
[super viewDidLoad];
CGRect frame = CGRectMake(0, 0, 320, 44);
aLabel = [[UILabel alloc] initWithFrame:frame];
aLabel.backgroundColor = [UIColor clearColor];
[aLabel setFont:[UIFont fontWithName:@"SerifGothic LT Black" size:25]];
aLabel.text = @"Sephardi Jews";
aLabel.textAlignment = NSTextAlignmentCenter;
aLabel.textColor =[UIColor whiteColor];
self.navigationItem.titleView = aLabel;
AboutNavViewController *about = [[AboutNavViewController alloc] init];
[self presentViewController:about animated:YES completion:nil];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
}
@end
我收到以下错误:
开始/结束外观转换的不平衡调用。
我究竟做错了什么?