xcode 属性'视图; 在“x”类型的对象上找不到

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6886438/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 21:37:00  来源:igfitidea点击:

Property 'View; not found on object of type "x"

iphoneobjective-ciosxcode

提问by Ryan Couch

I'm currently developing an Radio application for the iPhone on Xcode SDK iOS 5, and I'm currently using some elements from the StichedStreamPlayer that apple has made available. The problem i am having problem with is the ApplicationDidFinishLaunchingpart

我目前正在 Xcode SDK iOS 5 上为 iPhone 开发 Radio 应用程序,我目前正在使用苹果提供的 StichedStreamPlayer 中的一些元素。我遇到的问题是ApplicationDidFinishLaunching部分

Here is my Code:

这是我的代码:

appDelegate.m

#import "iGamerFMAppDelegate.h"

@class iGamerFMStreamingViewController;

@implementation iGamerFMAppDelegate

@synthesize window;

@synthesize iGamerFMViewController;

- (void)applicationDidFinishLaunching:(UIApplication *)application

{

    //Adds the streaming view controller once finished loading

    [window addSubview:iGamerFMViewController.view];

    [window makeKeyAndVisible];

}

-(void)dealloc

{

    [window release];

    [iGamerFMViewController release];

    [super dealloc];

}

@end

I get an error - Property 'View' not found on object of type "iGamerFMViewController" I have tried everything from rewriting it to copy and paste from another project and it still doesnt work. Do you know why this is happening?

我收到一个错误 - 在“iGamerFMViewController”类型的对象上找不到属性“视图”我已经尝试了从重写它到从另一个项目复制和粘贴的所有方法,但它仍然无法正常工作。你知道为什么会这样吗?

回答by Stephen

Make sure you have the right class selected for your view controller.

确保为视图控制器选择了正确的类。

enter image description here

在此处输入图片说明

回答by Paul.s

Can we see the code for iGamerFMViewController?

我们可以看到代码iGamerFMViewController吗?

I am assuming that iGamerFMViewControllershould subclass UIViewControllerso it should look like this

我假设iGamerFMViewController应该子类化,UIViewController所以它应该看起来像这样

@interface iGamerFMViewController : UIViewController

or if it does not does iGamerFMViewControllerhave a property called view

或者如果它没有iGamerFMViewController名为的属性view

Side note - Class' normally start with a capital letter it makes it clearer that it is a class and not a variable or method.

旁注 - Class' 通常以大写字母开头,这样可以更清楚地表明它是一个类而不是变量或方法。

Also you normally would do your #import "iGamerFMStreamingViewController.h"in the .m file otherwise the compiler has to read the whole class each as opposed to just it's header.

此外,您通常会#import "iGamerFMStreamingViewController.h"在 .m 文件中执行您的操作,否则编译器必须读取整个类,而不仅仅是它的标题。