1

我试图让这个视图旋转,以便在播放 youtube 视频时,可以全屏查看。

该视图嵌入在导航视图控制器和 tabBar 视图控制器中。

使用 Xcode 4.3 的目标部署是 iOS 5.1,在系留的 iPhone 4 和 iPhone 上的模拟器上进行测试。

我已经添加了:

-(BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}

到我的视图控制器,它应该允许屏幕根据设备方向旋转。

另请注意:我在信息设置中启用了横向,并在我的 plist 中进行了验证。这是我第一次在 stackoverflow 上发帖。我希望以上是清楚的。

这是完整的 .m 供参考:

//  Created by Jacob Topping on 12-03-20.
//  Copyright (c) 2012 The Melon Inc. All rights reserved.
//

#import "WebOneViewController.h"

@interface WebOneViewController ()

@end

@implementation WebOneViewController
@synthesize webOne;
@synthesize rotateWeb;
@synthesize follow;
@synthesize earnestWeb;
@synthesize ronWeb;
@synthesize richardWeb;
@synthesize davidWeb;

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}



- (void)viewDidLoad
{

    NSString *david = @"http://www.youtube.com/embed/YSbQ1SDwtgM";
    NSURL *url7 = [NSURL URLWithString:david];
    NSURLRequest *davidUrl = [NSURLRequest requestWithURL:url7];
    [davidWeb loadRequest:davidUrl];

    NSString *richard = @"http://www.youtube.com/embed/6jL_1kJ6pno";
    NSURL *url6 = [NSURL URLWithString:richard];
    NSURLRequest *richardUrl = [NSURLRequest requestWithURL:url6];
    [richardWeb loadRequest:richardUrl];

    NSString *ron = @"http://www.youtube.com/embed/E0EmDSg3YXY";
    NSURL *url5 = [NSURL URLWithString:ron];
    NSURLRequest *ronUrl = [NSURLRequest requestWithURL:url5];
    [ronWeb loadRequest:ronUrl];

    NSString *earnest = @"http://www.youtube.com/embed/oTG7JtdSpT8";
    NSURL *url4 = [NSURL URLWithString:earnest];
    NSURLRequest *earnestUrl = [NSURLRequest requestWithURL:url4];
    [earnestWeb loadRequest:earnestUrl];

    NSString *website3 = @"http://twitter.com/search/?src=hash&q=%23creb13";
    NSURL *url3 = [NSURL URLWithString:website3];
    NSURLRequest *requestUrl3 = [NSURLRequest requestWithURL:url3];
    [follow loadRequest:requestUrl3];

    NSString *website2 = @"http://themeloninc.com/The_Melon_Inc./app/Slider/demo/rotate.php";
    NSURL *url2 = [NSURL URLWithString:website2];
    NSURLRequest *requestUrl2 = [NSURLRequest requestWithURL:url2];
    [rotateWeb loadRequest:requestUrl2];

    NSString *website = @"http://www.youtube.com/embed/J2EWRG-epes";
    NSURL *url = [NSURL URLWithString:website];
    NSURLRequest *requestUrl = [NSURLRequest requestWithURL:url];
    [webOne loadRequest:requestUrl];

    //<iframe width="560" height="315" src="http://www.youtube.com/embed/J2EWRG-epes" frameborder="0" allowfullscreen></iframe>

    [scroller setScrollEnabled:YES];
    [scroller setContentSize:CGSizeMake(320,1150)];

    [super viewDidLoad];
    // Do any additional setup after loading the view.
}



- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
    return YES;
}

- (void)viewDidUnload
{
    [self setRichardWeb:nil];
    [self setRonWeb:nil];
    [self setEarnestWeb:nil];
    [self setFollow:nil];
    [self setRotateWeb:nil];
    [self setWebOne:nil];
    [super viewDidUnload];
    // Release any retained subviews of the main view.
}

@end
4

0 回答 0