Xcode:ViewController不显示。视图或addSubview:methods

Xcode:ViewController不显示。视图或addSubview:methods,xcode,uiviewcontroller,media-player,subview,Xcode,Uiviewcontroller,Media Player,Subview,我创建了两个ViewController(Xcode 4=>Storyboard)。之后,我创建了两个UIViewSubclass,分别称为PlayOutControlViewController.h和TVOutViewController.h 我想在外部显示器上显示视频,因此我尝试了以下操作: (添加了MediaPlayer.framework,将我的UIViewSubclass的类更改为PlayOut…和TVOut…-Controller.h) 对不起,我知道错误的意思,但不知道如何修复它们

我创建了两个ViewController(Xcode 4=>Storyboard)。之后,我创建了两个UIViewSubclass,分别称为PlayOutControlViewController.h和TVOutViewController.h

我想在外部显示器上显示视频,因此我尝试了以下操作:

(添加了MediaPlayer.framework,将我的UIViewSubclass的类更改为PlayOut…和TVOut…-Controller.h)

对不起,我知道错误的意思,但不知道如何修复它们

提前谢谢

另外,我在PlayoutViewController.m中,其中:

[self.view addSubview: (anyUIView)];
//works

//and

[PlayoutViewController.view addSubview: (anyUIView)];
//won't work.

。。。谢谢大家!

类及其实例是不同的东西

self.view
有效,因为类PlayoutViewController的实例具有
view
属性

PlayoutViewController.view
没有,因为类对象本身没有此属性。TVOutViewController也是如此-您应该调用实例,而不是类本身。

谢谢您

My TVOutViewController是UIViewController的一个子类,如下所述:

@interface TVOutViewController : UIViewController {    }
我在InterfaceBuilder中向TVOutViewController添加了一个UIView。我是否需要做其他事情才能做到:

[self.view addSubview: AnyUIView];
第二个问题:

如果我在TVOutViewController.m中声明一个方法,如:

+(void)addSubviewMethod:(id)sender { [self.view addSubview: AnyUIView]; }
为什么我不能在PlayoutControlViewController.m中调用它

[TVOutViewController addSubviewMethod];
我补充说

#import "TVOutViewController.h";
到PlayOutViewController.m文件

提前谢谢大家

好的,解决了:

你在正确的轨道上:

我忘了初始化对象。现在它就像一个符咒

TVOutViewController *MoviePlayerView = [[TVOutViewController alloc] init];
[MoviePlayerView.view addSubview:moviePlayer.view];

谢谢你的贡献。你能给我举个例子说明如何调用这些实例吗?谢谢大家!@达尔文的方法与调用
self
实例的方法相同。您是如何创建TVOutViewController类型的对象的?
TVOutViewController *MoviePlayerView = [[TVOutViewController alloc] init];
[MoviePlayerView.view addSubview:moviePlayer.view];