私はこのような質問がすでにそこにあるかもしれないことを知っていますが、私のような他の人のために私は先に進んで尋ねます
縦向きのみを許可するように設定されているアプリがありますが、横向きでも動画のみを再生できるようにしたいので、この設定は動画に影響します。これを機能させるために.mファイルに追加できる方法はありますか?これが私のコードです。
#import "BIDVideosViewController.h"
@interface BIDVideosViewController ()
@end
@implementation BIDVideosViewController
@synthesize moviePlayer ;
@synthesize tableList;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
UITableView *table = [[UITableView alloc]initWithFrame:self.view.bounds];
[table setDelegate:self];
[table setDataSource:self];
[self.view addSubview:table];
tableList = [[NSMutableArray alloc] initWithObjects:@"Gangan",@"SwimGood",@"German Ice", nil];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [tableList count];
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *DisclosureButtonIdentifier = @"DisclosurebutotonIdentifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:DisclosureButtonIdentifier];
if (cell == nil)
{
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:DisclosureButtonIdentifier];
}
NSInteger row = [indexPath row];
NSString *rowString = [tableList objectAtIndex:row];
cell.textLabel.text = rowString;
return cell;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
{
NSBundle *str = [tableList objectAtIndex:indexPath.row];
if ([str isEqual:@"Gangan"])
{
NSBundle *bundle = [NSBundle mainBundle];
NSString *thePath = [bundle pathForResource:@"Gangan" ofType:@"mp4"];
NSURL *theurl = [NSURL fileURLWithPath:thePath];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:theurl];
[moviePlayer setMovieSourceType:MPMovieSourceTypeFile];
[self.view addSubview:moviePlayer.view];
[moviePlayer setFullscreen:YES];
[moviePlayer play];
}
else if ([str isEqual:@"SwimGood"])
{
NSBundle *bundle = [NSBundle mainBundle];
NSString *thePath = [bundle pathForResource:@"SwimGood" ofType:@"mp4"];
NSURL *theurl = [NSURL fileURLWithPath:thePath];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:theurl];
[moviePlayer setMovieSourceType:MPMovieSourceTypeFile];
[self.view addSubview:moviePlayer.view];
[moviePlayer setFullscreen:YES];
[moviePlayer play];
}
else if ([str isEqual:@"German Ice"])
{
NSBundle *bundle = [NSBundle mainBundle];
NSString *thePath = [bundle pathForResource:@"German Ice" ofType:@"mp4"];
NSURL *theurl = [NSURL fileURLWithPath:thePath];
moviePlayer = [[MPMoviePlayerController alloc] initWithContentURL:theurl];
[moviePlayer setMovieSourceType:MPMovieSourceTypeFile];
[self.view addSubview:moviePlayer.view];
[moviePlayer setFullscreen:YES];
[moviePlayer play];
}
}
}
@end