[英]objective C OSX - Delegate- unrecognized selector sent to instance
The changeView_ShowContact method will make a view controller to show up just fine. changeView_ShowContact方法将使视图控制器显示得很好。 But when I call the changeView_ShowContact from another class it wont work.
但是,当我从另一个类调用changeView_ShowContact时,它将无法工作。 Im getting an error in the log "unrecognized selector sent to instance."
我在日志“无法识别的选择器发送给实例”中遇到错误。
@protocol callingActions_fromMainNavigation <NSObject>
- (IBAction)changeView_ShowContact:(id)sender;
@end
**@interface Navigation_Main : NSViewController**
@property (nonatomic, strong) id <callingActions_fromMainNavigation> delegate;
**@implementation Navigation_Main**
@synthesize delegate;
- (IBAction)changeView_ShowContact:(id)sender;
{
NSLog(@"********************ShowContact");
AddStuffViewController = [[pageContact alloc] initWithNibName:@"pageContact" bundle:nil];
[AddStuffView addSubview:[AddStuffViewController view]]; //<This call here works ok.
}
. 。
@interface contacts : NSObject <callingActions_fromMainNavigation>
**@implementation contacts**
-(void)myMethodCall:(id)sender;
{
Navigation_Main *NavMain = [[Navigation_Main alloc] initWithNibName:@"Navigation_Main.h" bundle:nil];
[NavMain setDelegate:self];
[self changeView_ShowContact:nil];
//I need to call the (IBAction)changeView_ShowContact in the Main Navigation. This
//code is not working.
}
似乎您的contacts
在没有实现contacts
类中的changeView_ShowContact:
情况下采用了callingActions_fromMainNavigation
协议。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.