应该在视图聚焦时调用方法

时间:2011-11-14 11:54:40

标签: objective-c inappsettings

在我的iOS项目中,我使用InAppSettings。这是missing a delegate in the modal view controller for willDismiss.

因此,当模态视图被解除时,我想在我的主视图控制器中调用一个方法。我怎样才能做到这一点?视图控制器中是否有一个方法在视图再次处于焦点时被触发?

2 个答案:

答案 0 :(得分:1)

在解除其提供的模态对话框

后,将在视图上调用它们
- (void) viewWillAppear
- (void) viewDidAppear:(BOOL)animated

答案 1 :(得分:1)

你可以试试这样的事情

BOOL settingsLaunched = NO;

-(void)presentInAppSettingsViewController
{
    //Show the settings modal view controller here

    //Set our flag
    settingsLaunched = YES;
}

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

    if(settingsLaunched)
    {
        //Your code here
    }
}