changeView_ShowContact方法将使视图控制器显示得很好。但是当我从另一个类调用changeView_ShowContact时它不会工作。我在日志中收到错误“无法识别的选择器发送到实例”。
@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.
}
答案 0 :(得分:1)
您似乎已contacts
采用callingActions_fromMainNavigation
协议而未在changeView_ShowContact:
班级中实施contacts
。