0

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.
}
4

1 回答 1

1

看起来您正在contacts采用callingActions_fromMainNavigation协议而没有changeView_ShowContact:contacts课堂上实施。

于 2013-03-09T19:57:17.150 回答