2013-03-09 3 views
0

changeView_ShowContact 메소드를 사용하면보기 컨트롤러가 올바르게 표시됩니다. 하지만 다른 클래스에서 changeView_ShowContact를 호출하면 작동하지 않을 것입니다. 로그에 "인스턴스로 보낸 인식 할 수없는 선택기"오류가 발생했습니다.objective C OSX - 대리인 - 인스턴스로 전송 된 알 수없는 선택자

@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. 
} 
+1

밑줄은 클래스 이름에 거의 사용되지 않으며'contacts' 클래스는 대문자이어야하며 이상적으로 3 자의 고유 한 접두어가 있어야합니다. – CodaFi

답변

1

당신이 발생하는 것 같습니다 당신의 contacts 밖으로는 contacts 클래스 changeView_ShowContact:을 구현하기로 callingActions_fromMainNavigation 프로토콜을 채택한다.

+0

오류가 수정되었습니다. 감사. – user1642542

+0

좋아요, 표시 할 수 있습니까? –

관련 문제