我从 UIView 派生了一个 SignalView 类,但是当我向 SignalView 类型的对象发送消息时,它被发送到 UIView 并且出现错误:
-[UIView Initialise]: unrecognized selector sent to instance 0x1b3900
我的对象在调试监视窗口中也显示为 UIView 对象:
m_signalview UIView * 0x001b3900
相关代码是:
// signalview.h
#import <UIKit/UIKit.h>
@interface SignalView : UIView
{
}
-(void)Initialise;
@end
//signalview.m
#import "SignalView.h"
@interface SignalView ()
@end
@implementation SignalView
-(void)Initialise
{
}
// viewcontroller.h
#import <UIKit/UIKit.h>
#import "SignalView.h"
@interface ViewController : UIViewController
@property (weak, nonatomic) IBOutlet SignalView *m_signalview;
@end
// viewcontroller.m
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize m_signalview;
- (void)viewDidLoad
{
[super viewDidLoad];
NSLog(@"%@", m_signalview);
[m_signalview Initialise];
}