视频无法在lanscape模式下播放尝试此代码返回YES;在方向仍然没有在lanscape模式下播放这是我正在使用的代码 是否在xcode 4.2中以横向模式播放视频有任何不同的代码
//
// New_page.m
// salah1
//
// Created by on 30/11/2011.
// Copyright (c) 2011 j h . All rights reserved.
//
#import "New_page.h"
#import "Custom_cell.h"
#import "Mynewpage.h"
@implementation New_page
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)didReceiveMemoryWarning
{
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
#pragma mark - View lifecycle
- (void)viewDidLoad
{
mydata = [[NSMutableArray alloc]initWithObjects:@"When was salah made compulsory?",@"Al- Mi'raj:The Alleged Ascent to Heaven",nil];
myaudio = [[NSMutableArray alloc]initWithObjects:@"Video1",@"2",nil];
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
}
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
return [mydata count];
}
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"Custom_cell";
Custom_cell *cell = (Custom_cell *) [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (indexPath.section == 0) {
}
if (cell == nil) {
NSArray *topLevelObjects = [[NSBundle mainBundle] loadNibNamed:@"Custom_cell" owner:self options:nil];
//cell = [[[Custom_cell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:CellIdentifier] autorelease];
for (id currentObject in topLevelObjects)
{
if ([currentObject isKindOfClass:[UITableViewCell class]])
{
cell = (Custom_cell *) currentObject;
// cell.backgroundView.backgroundColor = [UIColor clearColor];
break;
}
}
}
cell.lbl.text = [mydata objectAtIndex:indexPath.row];
return cell;
// [myString release];
}
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
Mynewpage *page = [[Mynewpage alloc]init];
page.urlname = [myaudio objectAtIndex:indexPath.row];
[self.navigationController pushViewController:page animated:YES];
}
- (void)viewDidUnload
{
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
@end
答案 0 :(得分:0)
你的shouldAutorotateToInterfaceOrientation方法应该返回YES而不是仅用于肖像
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return YES;
}