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

前端 未结 2 701
眼角桃花
眼角桃花 2020-12-06 23:52

I am doing a book kinda application using a viewBased application. The mainView acts as the backgroundView for loading pages. Each page is a different view and have its own

2条回答
  •  我在风中等你
    2020-12-07 00:35

    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]`
    

提交回复
热议问题