gpt4 book ai didi

iphone - .h 实现文件无法识别我的 UIViewController

转载 作者:行者123 更新时间:2023-11-28 17:34:08 24 4
gpt4 key购买 nike

更新:现在一切正常,忘记链接 .xib 文件中的 View 。

我已经像这样导入了我的 View Controller 的实现文件;

#import "TopicsListParentViewController.h"

当我写的时候:

TopicsListParentViewController *tlparentview;

一开始没有报错,后来在构建项目的时候出现了这个错误:

未知类型名称“TopicsListParentViewController”;您是说“TopicsListViewController”吗?

为什么会这样,我该如何解决?下面是一个屏幕截图,可以帮助您更准确地想象场景:

enter image description here

编辑:这是“TopicsListParentViewController”的 .h 和 .m

.h 实现文件:

//
// TopicsListParentViewController.h
//
// Created by James Anderson on 27/04/2012.
// Copyright (c) 2012 PixelBit Apps Ltd. All rights reserved.
//

#import "SuperChatAppDelegate.h"
#import "TopicsListViewController.h"

@interface TopicsListParentViewController : UIViewController {

IBOutlet UIView *parentview;

IBOutlet TopicsListViewController *topicsListViewController;

}

@end

.m 实现文件:

//
// TopicsListParentViewController.m
//
// Created by James Anderson on 27/04/2012.
// Copyright (c) 2012 PixelBit Apps Ltd. All rights reserved.
//

#import "TopicsListParentViewController.h"

@implementation TopicsListParentViewController

-(void)viewDidLoad
{

[parentview addSubview:topicsListViewController.tableView];
NSLog(@"Added subview");

}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations.
return (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation == UIInterfaceOrientationLandscapeRight);
}

- (void)dealloc {
[super dealloc];
}

@end

最佳答案

仔细检查以确保您的文件正确。

 @interface TopicsListParentViewController
...
@end

 @implementation TopicsListParentViewController
...
@end

关于iphone - .h 实现文件无法识别我的 UIViewController,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10345667/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com