屏幕方向Xcode 4.3 iOS5.1

时间:2012-11-27 18:05:42

标签: ios xcode rotation uiinterfaceorientation

我正在尝试将此视图旋转,以便在播放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

0 个答案:

没有答案