1

我有一个弹出视图,我也添加了一个 PFQueryTableViewController 作为 childviewController。我在弹出窗口上有一个按钮,当按下它时,应该重新加载 PFQueryTableViewController 中的 tableview。

这是 buttonPressed 方法中应该执行此操作的代码:

NotificationsTableViewController *note = (NotificationsTableViewController *)self.childViewControllers[0];
[note loadObjects];
[note.tableView reloadData];

但是,该表没有重新加载,我可以让它重新加载的唯一方法是实例化一个全新的控制器并将其添加到弹出框,这不是我最终想要做的事情。

这是更多代码:

//NotificationsPopoverController

@class NotificationsTableViewController;

@protocol PopDelegate <NSObject>

-(void) changedQue;
@end

@interface NotificationsPopoverController : PDPopoverController

@property (nonatomic, assign) id<PopDelegate>  myDelegate;

@property NotificationsTableViewController *noti;

当我按下按钮时,我调用 [self.myDelegate changedQue];

//NotificationsTableViewController.h

@interface NotificationsTableViewController : PFQueryTableViewController <PopDelegate>

//NotificationsTableViewController.m

-(void)changedQue
{
    NSLog(@"Did it work?");

    [self.tableView reloadData];
    [self loadObjects];

}

由于某种原因没有打印日志语句,不知道为什么......

4

1 回答 1

0

我还没有完全理解流程。我认为您必须在某个地方添加self.note.myDelegate = self;. 嗯...我认为您错误地实施了委托。你能在两个视图控制器上粘贴更完整的代码吗?

按照 Jacob 的说法,添加self.myDelegate = self.noti; 在子视图通知解决问题之后。

于 2014-07-04T03:46:58.547 回答