0

In my app I push a viewcontroller on top of an other when a uitableviewcell gets selected. 当我从顶部弹出新的视图控制器时,我会回到我开始使用的那个。发生这种情况时,我想执行刷新操作,但我不知道如何捕获此事件。我怎样才能做到这一点?

4

2 回答 2

5

尝试其中之一:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];

    BOOL pushed = [self isMovingToParentViewController];

    printf("viewWillAppear     %d\n", pushed);

}

- (void)viewWillDisappear:(BOOL)animated
{
    [super viewWillDisappear:animated];

    BOOL popped = [self isMovingFromParentViewController];

    printf("viewWillDisappear     %d\n", popped);

}

来自 Apple 文档:http: //developer.apple.com/library/ios/#documentation/uikit/reference/UIViewController_Class/Reference/Reference.html

于 2012-08-14T13:25:55.033 回答
0

使用 UIViewController viewWillAppear 委托方法

于 2012-08-14T13:26:14.563 回答