【发布时间】:2015-05-28 06:50:46
【问题描述】:
我在下面有一个名为 TestView.h 的子类 UIView:
#import <UIKit/UIKit.h>
#import "TestsViewController.h"
@interface TestView : UIView
// To get the navigation controller parent clas
@property (nonatomic, retain) TestsViewController *parent;
上面的行导致错误:未知类型名称TestViewController:你的意思是CostViewController
- (id) initWithFrame:(CGRect)frame andObjects:(PFObject *)objects;
@end
我在下面有TestsViewController.h:
#import "CostViewController.h"
#import "TesView.h"
@interface TestsViewController : UIViewController <UITextViewDelegate, CostViewControllerDelegate, UIScrollViewDelegate>
@end
在TestsViewController.m 的实现文件中,我称之为:
TestView *tests = [[TestView alloc] initWithFrame:frame andObjects:replies];
tests.parent = self;
但是上面一行给出了一个错误:
不兼容的指针类型从 TestsViewController * 分配给 CostsViewController *
这有什么问题?
CostViewController.h 是:
#import <UIKit/UIKit.h>
#include <stdlib.h>
@class CostViewController;
@protocol CostViewControllerDelegate <NSObject>
// Functions for delegate
@end
@interface CostViewController : UIViewController <UIImagePickerControllerDelegate, UINavigationControllerDelegate, UITextViewDelegate, MBProgressHUDDelegate>
{
MBProgressHUD *HUD;
MBProgressHUD *refreshHUD;
}
@property (nonatomic, weak) id <CostViewControllerDelegate> delegate;
@end
谢谢。
【问题讨论】:
-
CostViewController 是什么/在哪里?
-
尝试@class TestsViewController 而不是#import。
标签: ios objective-c uiview uiviewcontroller uinavigationcontroller