如何检查故事板中的哪个视图正在显示

时间:2013-05-09 13:51:55

标签: iphone ios xcode uistoryboard

我想知道哪个故事板视图正在显示。

 [self setLeftPanel:[self.storyboard instantiateViewControllerWithIdentifier:@"menuListViewController"]];
    [self setCenterPanel:[self.storyboard instantiateViewControllerWithIdentifier:@"NavCenterController"]];
    [self setRightPanel:[self.storyboard  instantiateViewControllerWithIdentifier:@"designView"]];

我想检查是否显示“NavCenterController”,禁用某些内容

任何评论都表示赞赏。

1 个答案:

答案 0 :(得分:2)

如果我理解您的要求,为了检查是否显示任何视图,您应该检查其window属性。 对于视图控制器,您将执行以下操作:

if(self.view.window)
    // the view controller is being shown, do something
else
    // the view controller is not being shown
相关问题