更新:現在所有的工作,忘記鏈接在.xib文件中的視圖。.h實現文件將無法識別我的UIViewController
我導入了我的視圖控制器的實現文件就像這樣;
#import "TopicsListParentViewController.h"
當我寫:
TopicsListParentViewController *tlparentview;
有起初沒有錯誤,但隨後建設項目時,出現此錯誤:
未知類型名 'TopicsListParentViewController';你的意思是'TopicsListViewController'嗎?
這是爲什麼,我該如何解決?下面是截圖,以幫助您想象的情景更準確:
編輯:這裏是 「TopicsListParentViewController」
.H實現文件h和.M:
//
// 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
你能告訴我們.h和.m的TopicsListParentViewController ..? – 2012-04-27 06:20:01
檢查您的文件名...它可能會被更改... – Nit 2012-04-27 06:20:16
也檢查您的類名稱在TopicsListParentViewController.h太。 – tia 2012-04-27 06:21:24