iphone - Call Delegate method from UIPopover -


i have popover gets loaded navigation controller, displays itemsview xib, , have delegate method popover can dismissed main view controller. works fine, until drill down next level in uitableview (which loads detail view). once detail view loaded, can not call dismiss method on main view controller. quite new delegates , appreciate guidance. thank you!

mainview ---> itemsview -----> detailview

how call delegate method located on mainview detailview?

//load popover first view:      itemsview *popoverview = [[itemsview alloc] init];  uinavigationcontroller *navcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:popoverview];  self.popovercontroller = [[[uipopovercontroller alloc] initwithcontentviewcontroller:navcontroller] autorelease];  popoverview.delegate = self;  [navcontroller release];  [popovercontroller setpopovercontentsize:cgsizemake(450.0, 300.0)]; [popovercontroller presentpopoverfromrect:addbutton.frame inview:self.view permittedarrowdirections:uipopoverarrowdirectiondown animated:yes];  [popoverview release]; 

now push detail view:

//push detailview      if(self.secondview == nil) {      nslog(@"called");      adddetail *viewcontroller = [[adddetail alloc] initwithnibname:@"adddetail" bundle:nil];      self.secondview = viewcontroller;      [viewcontroller release];  }  // setup animation  secondview.contentsizeforviewinpopover = self.view.bounds.size; self.contentsizeforviewinpopover = self.view.bounds.size;  [self.navigationcontroller pushviewcontroller:self.secondview animated:yes];   } 

write property , method in detail view following.

  • property id myparent
  • method (void)setparent:parent { myparent = parent;}

while pushing detailviewcontroller call method as.

  • [detailviewcontroller setparent:self];

now can call method declared in parent

  • [myparent yourmethodname];

hope helps


Comments

Popular posts from this blog

php - What is the difference between $_SERVER['PATH_INFO'] and $_SERVER['ORIG_PATH_INFO']? -

fortran - Function return type mismatch -

queue - mq_receive: message too long -