objective c - Method implemented from delegate not triggered -
i have uiviewcontroller embedded in navigation controller , presented modally:
//uiviewcontroller authenticationcontroller *auth = [[authenticationcontroller alloc] init]; //uinavigationcontroller authrootcontroller *navcontroller = [[authrootcontroller alloc] initwithrootviewcontroller:auth]; navcontroller.navigationbar.topitem.title = @"anmelden"; navcontroller.delegate = self; [self presentmodalviewcontroller:navcontroller animated:yes]; release_safely(navcontroller);
however there wrong delegate created within authrootcontroller class:
@protocol authrootcontrollerdelegate @required -(void)authrootcontrollerdidend:(uinavigationcontroller *)sender; @end @interface authrootcontroller : uinavigationcontroller { id<authrootcontrollerdelegate> delegate; } @property (nonatomic, assign) iboutlet id delegate; @end
and implementation:
@implementation authrootcontroller @synthesize delegate; -(void)userdidcancelcontroller:(uinavigationcontroller *)sender{ if (self.delegate && [self.delegate conformstoprotocol:@protocol(authrootcontrollerdelegate)]) { [self.delegate authrootcontrollerdidend:sender]; } } @end
when use method
-(void)authrootcontrollerdidend:(uinavigationcontroller *)sender
it not triggered. ideas?
have declared delegate conforms authrootcontrollerdelegate? conformstoprotocol test looks @ whether delegate declares conformance, doesn't sort of method-by-method check. if you've implemented authrootcontrollerdidend: on delegate, conformstoprotocol can still return no.
Comments
Post a Comment