ios - delegate help code not behaving as expected -


really simple question think.

i have main view , popover view.

i trying make custom delegate enable me close popover view @ times. code posted below. real simple issue having code dosnt appear entering delegate code. ideas why? builds , runs nothing appears happen, have put nslog statments, popover nslog appears function in mainview dismisspopover nothing.

mainview.h

@interface mainscreen : uiviewcontroller<dismisspopoverdelegate> 

mainview.m

- (void) dismisspopover:(nsnumber *)dataa { /* dismiss popover here , process data */ [popovercontroller dismisspopoveranimated:yes]; nslog(@"ololo");     } 

popover.h

@protocol dismisspopoverdelegate - (void) dismisspopover:(nsnumber *)yourdatatotransfer; @end   @interface selectagepopover : uiviewcontroller<uitableviewdatasource, uitableviewdelegate,uipopovercontrollerdelegate>{  nsarray *items; id<dismisspopoverdelegate> delegate;   }  @property (nonatomic, assign) id<dismisspopoverdelegate> delegate; 

popover.m

[self.delegate dismisspopover:selrow]; 

where want delegate called.

thanks

the popover view called following method in main view.m

       controller = [[selectagepopover alloc] initwithnibname:@"selectagepopover" bundle:nil];     popovercontroller = [[uipopovercontroller alloc] initwithcontentviewcontroller:controller];     [popovercontroller setdelegate:self];       popovercontroller.popovercontentsize = cgsizemake(250, 294);     if ([popovercontroller ispopovervisible]) {         [popovercontroller dismisspopoveranimated:yes];     } else {         cgrect poprect = cgrectmake((self.agerangetextfield.frame.origin.x+50),                                     (self.agerangetextfield.frame.origin.y+50),                                     (self.agerangetextfield.frame.size.width),                                     (self.agerangetextfield.frame.size.height));         [popovercontroller presentpopoverfromrect:poprect inview:self.view permittedarrowdirections:uipopoverarrowdirectionany animated:yes];     } } 

on instantiate instance of selectagepopover, need set delegate of selectagepopover instance mainscreen (self) in mainview.m, example:

controller = [[selectagepopover alloc] initwithnibname:@"selectagepopover" bundle:nil]; ; controller.delegate = self; 

please try set controller delegate shown above.

in selectagepopover.h class file, not need set uipopovercontrollerdelegate though.


Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -