Neh*_*hta 14 iphone uiviewcontroller ipad ios
我在自身对象上展示了一个包含UIViewController的UINavigationController,其代码如下
  drawController = [[DrawImageViewController alloc] initWithNibName:nil bundle:nil];
[drawController setDrawControllerDelegateObject:self];
UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:drawController];
[self presentModalViewController:nav animated:YES];
[nav release];
但是在第二次调用上面的代码之前,我想知道屏幕上出现的当前视图控制器是否是drawController.我正在使用以下代码
    if (drawController && [drawController isBeingPresented])
但它不适合我,也适用于iOS 5.0,所以我被困在这里.请帮助我知道我应该怎么知道屏幕上出现的当前UIViewController是哪个类以及drawContoller是否仍然出现在屏幕上?对不起我的错字错误,如果有的话.任何帮助将不胜感激.
谢谢Neha Mehta
Par*_*iya 22
使用navigationController's visibleViewController property并isKindOfClass method了解最新信息top:
if([self.navigationController.visibleViewController isKindOfClass:[yourcontroller class]])
   //exists
else
   //not exists
不是最漂亮的代码,但这应该工作:
if ([self.presentedViewController isKindOfClass:[UINavigationController class]] &&
   ((UINavigationController *)self.presentedViewController).topViewController == drawController) {
   …
| 归档时间: | 
 | 
| 查看次数: | 14725 次 | 
| 最近记录: |