Code is exectuting but the view is not loading when called form a function?

浪尽此生 提交于 2019-11-28 01:42:08

You need to have refernce of the background view controller in the popover controller.

In the PopController controller you should have a delagate like:

@interface PopController: UITablViewController{

  //// other varibales;
      id delegate;
}

@property (nonatomic, retain) id delgate;

Now from the class in which you are showing the popovercontroller

you should add this line:

[myPopController setDelegate:self];

Then you can easily acces any method of the main view controller class. By using

[delegate callTheRequiredMethod];

Hope this helps.

Thanks,

Madhup

It's hard to tell what's going wrong without looking at the code. That said, here's what I'd do:

(1) When a row is selected in mainView, present the popoverController modally:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    PopoverViewController *vc = [[PopoverViewController alloc] init];
    [self.navigationController presentModalViewController:vc animated:YES];        
    [vc release];
}

(2) When something changes in the popoverController, for example a row is selected, set a value in the parentViewController (which should be the MainView):

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    self.parentViewController.value = someValue;
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

(3) Dismiss the popoverController where-ever you choose by calling:

[self dismissModalViewControllerAnimated:YES]`
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!