以我的應用程序委託後的UIView不響應的觸摸,直到用戶執行我創建與一羣視圖控制器,用於它的再一個單獨的UIViewController我顯示爲最上面的視圖選項卡控制器某些行動。「removeFromSuperview」
我最初覆蓋了我的第二個控制器選項卡控制器,但最終,第二控制器通過「removeFromSuperview」駁回。但是,在發生這種情況後,選項卡控制器視圖將不會響應任何點擊或任何UI交互。我的應用程序沒有掛起,因爲我可以看到處理髮生。
有沒有一種方法,使成爲事實上的應答器選項卡控制器最上面的觀點是駁回後?
以下是我最初創建兩個視圖控制器:
{
// main navigation controller is a tab bar
UITabBarController *tabBarController = [[UITabBarController alloc] init];
tabBarController.viewControllers = [NSArray arrayWithObjects: controller1,
controller2,
controller3, nil];
// Add the tab bar to the view
[window addSubview:tabBarController.view];
// Creating the 2nd navigation controller - covering up the tab bar
// temporarily
UIViewController *viewController = [[MySecondViewController alloc]
initWithNibName:@"SomeView"
bundle:nil];
UINavigationController *navController = [[UINavigationController alloc]
initWithRootViewController:viewController];
[viewController release];
// Configure and show the second navigation controller
[window addSubview:[navController view]];
// Make everything visible
[window makeKeyAndVisible];
}
如何最頂部的視圖被駁回:
@interface MySecondViewController : UIViewController
{
}
-(void)dismissMe;
@end
@implementation MySecondViewController
-(void)dismissMe
{
// Here, the this view is getting removed
[self.view removeFromSuperview];
}
@end
我不想最頂部的視圖的樣子,我加入一個模式對話框,並希望屏幕在應用程序啓動後立即到場。
我試過這些,但沒有工作;但是它給了我一個嘗試別的東西的想法,這是成功的。我提出的UIWindow類交換dismissMe視圖像這樣: [appDelegate.window exchangeSubviewAtIndex:0 withSubviewAtIndex:1]; \t \t \t \t [appDelegate.tabBarController.view becomeFirstResponder]; 除了這導致了另一個問題,其中狀態欄中的UIButton項目不會響應啓用/禁用。爲此發佈一個單獨的問題。 – 2010-01-24 19:30:34