【问题标题】:Video not playing in landscape mode (xcode 4.2)视频未在横向模式下播放(xcode 4.2)
【发布时间】:2011-12-08 17:28:49
【问题描述】:

视频未在横向模式下播放尝试此代码返回 YES;在方向上仍然没有在横向模式下播放这是我正在使用的代码 在 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

【问题讨论】:

    标签: iphone objective-c ios xcode sdk


    【解决方案1】:

    你的 shouldAutorotateToInterfaceOrientation 方法应该返回 YES 而不仅仅是纵向

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
     {
    // Return YES for supported orientations
    return YES;
    }
    

    【讨论】:

    • 更改后,视频以横向播放,但不是全横向视频仅在屏幕左下方播放,其余部分就像方形黑色
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-06-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多