但是,如果我从一个笔尖加载视图,或者甚至从一个程序视图控制器,ipad显示纵向视图(是的,两种情况都设置为横向)。
也就是说
ExternalVIEwController *ex = [[ExternalVIEwController alloc] init];[externalWindow setRootVIEwController:ex];
做这个:
如果我创建视图本身程序。像这样:
UIVIEw *test = [[UIVIEw alloc] initWithFrame:[externalScreen applicationFrame]];[test setBackground@R_301_6004@:[UI@R_301_6004@ white@R_301_6004@]];UILabel *msgLabel = [[UILabel alloc] initWithFrame:CGRectMake(10,40,100,30)];msgLabel.text = @"External!";[test addSubvIEw:msgLabel];
它运行像某种形式的神奇梦想:
但我想要vIEwcontroller加载(和工作!)所以,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 setBackground@R_301_6004@:[UI@R_301_6004@ yellow@R_301_6004@]]; self.vIEw = [[UIVIEw alloc] initWithFrame:rect]; self.vIEw.background@R_301_6004@ = [UI@R_301_6004@ white@R_301_6004@]; return self; }}- (voID)loadVIEw{ self.vIEw = [[UIVIEw alloc] initWithFrame:rect]; self.vIEw.background@R_301_6004@ = [UI@R_301_6004@ black@R_301_6004@]; [self.vIEw addSubvIEw:externalVIEw];}
根据要求,这是我如何加载vIEwcontroller,初始化外部屏幕的大小。谢谢
解决方法 只是返回NO在 – (BOol)shouldautorotatetoInterfaceOrIEntation:(UIInterfaceOrIEntation)interfaceOrIEntation在你的UIVIEwController子类。// ugly,don't use this in real codeif ([UIScreen screens].count == 1) return; // just one screen,eww.// getting the secondary screenUIScreen *screen = [[UIScreen screens] objectAtIndex:1];__block UIScreenMode *highestWIDthMode = NulL;[screen.availableModes enumerateObjectsUsingBlock:^(ID obj,NSUInteger IDx,BOol *stop) { UIScreenMode *currentModeInLoop = obj; if (!highestWIDthMode || currentModeInLoop.size.wIDth > highestWIDthMode.size.wIDth) highestWIDthMode = currentModeInLoop;}];// setting to the highest resolution availablescreen.currentMode = highestWIDthMode;NSLog(@"screen.currentMode = %@",screen.currentMode);screen.overscanCompensation = UIScreenOverscanCompensationScale;// initializing screenseconDWindow = [[UIWindow alloc] initWithFrame:[screen bounds]];[seconDWindow setScreen:screen];// other vIEw is a UIVIEwController,just remember to return NO in - (BOol)shouldautorotatetoInterfaceOrIEntation:(UIInterfaceOrIEntation)interfaceOrIEntation or the iOS will rotate the frame.UIVIEwController *vc = [[OtherVIEw alloc] initWithNibname:@"OtherVIEw" bundle:nil];seconDWindow.rootVIEwController = vc;[seconDWindow makeKeyAndVisible];总结
以上是内存溢出为你收集整理的IOS – 外部(hdmi)输出只填充屏幕的一半,除非手动编码视图全部内容,希望文章能够帮你解决IOS – 外部(hdmi)输出只填充屏幕的一半,除非手动编码视图所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)