因此,正如标题所说,我在iPad上有一个hdmi和注册用于屏幕连接的观察者,一旦连接,用户选择res并输出一个视图。但是,如果我从笔尖或甚至从程序视图控制器加载视图,则ipad将以纵向显示横向视图(是的,两种情况均设置为横向)。IOS - 外部(HDMI)输出只填充屏幕的一半,除非手动编码视图
I.e.
ExternalViewController *ex = [[ExternalViewController alloc] init];
[externalWindow setRootViewController:ex];
做到这一点:
如果我创建视图本身编程。像这样:
UIView *test = [[UIView alloc] initWithFrame:[externalScreen applicationFrame]];
[test setBackgroundColor:[UIColor whiteColor]];
UILabel *msgLabel = [[UILabel alloc] initWithFrame:CGRectMake(10, 40, 100, 30)];
msgLabel.text = @"External!";
[test addSubview:msgLabel];
它运行像某种形式的神奇梦想:
但是我希望视图 - 控制加载(而努力!)所以,StackOverflow的,我问你。有没有人遇到过这个?
编辑:它不用说,常见的感性答案不会得到赏金,我是在修复后,而不是解决方法。有了我有限的大脑,我所能想到的就是创建一个方法,根据它的输入创建一个视图,并将其作为外部监视器的子视图,很明显这是一种黑客解决方案,因此我们希望能够解决这个问题!谢谢!
编辑:
-(id)initWithFrame:(CGRect)_rect
{
rect = _rect;
if (self = [super init])
{
externalView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"105.png"]];
externalView.alpha = 0.0;
[externalView setFrame:rect];
[externalView setBackgroundColor:[UIColor yellowColor]];
self.view = [[UIView alloc] initWithFrame:rect];
self.view.backgroundColor = [UIColor whiteColor];
return self;
}
}
- (void)loadView
{
self.view = [[UIView alloc] initWithFrame:rect];
self.view.backgroundColor = [UIColor blackColor];
[self.view addSubview:externalView];
}
按照要求,这是我如何加载视图 - 控制与外部屏幕的大小初始化。谢谢
“纵向景观视图”被截断或旋转了吗?我的意思是,如果您在第二个示例中添加了标签,它会显示在屏幕左上角还是左下角呈90度? – jrturton
对不起,应该说明一下。当您在屏幕的一半中看到视图时,它是风景但旋转。所以,如果我添加一个标签,那么它会显示它随着从下到上的文本旋转。 –
你可以包含来自'nibless'视图控制器的'loadView'方法的代码,展示如何创建视图,从哪里获取外部显示的尺寸等? – jrturton