2
我創建了一個加載UIWindow,我打電話時和makeKeyAndVisible
當我開始加載。完成後,我的主UIWindow爲makeKeyAndVisible
。但是我的問題是在做完這個之後,當我點擊一個文本字段時,鍵盤沒有彈出。這在Cursor is blinking in UITextField but keyboard doesn't appear被問到,但我找不到正確的答案。鍵盤不提供多個UIWindow
編輯:在UIView中,當我點擊地址欄時,鍵盤確實出現,但我無法輸入。但在谷歌的網頁中,當我點擊搜索文本字段時,鍵盤沒有出現。
- (void)showLoading:(NSString*)text
{
loadingWindow = [[UIWindow alloc] init];
[[UIApplication sharedApplication] beginIgnoringInteractionEvents];
mainWindow = UIApplication.sharedApplication.keyWindow;
[loadingWindow setFrame:CGRectMake(0, 0, boundWidth, boundHeight)];
[loadingWindow setRootViewController:[[UIViewController alloc] init]];
[loadingWindow.rootViewController setView:[[UIView alloc] init]];
[loadingWindow.rootViewController.view setFrame:loadingWindow.frame];
[loadingWindow setHidden:NO];
}
- (void)hideLoading
{
[loadingWindow setHidden:YES];
[loadingWindow removeFromSuperview];
}
爲什麼要添加一個新窗口? iOS應用程序應該只有一個窗口,並且只能在AppDelegate中設置。 – AMayes 2013-03-21 18:11:30
我相信你錯了。看看http://stackoverflow.com/questions/8232398/advantages-problems-examples-of-adding-another-uiwindow-to-an-ios-app – AliBZ 2013-03-21 18:12:24
「除非應用程序可以在外部設備屏幕上顯示內容,一個應用程序只有一個窗口。「 [UIWindow文檔](http://developer.apple.com/library/ios/#documentation/uikit/reference/UIWindow_Class/UIWindowClassReference/UIWindowClassReference.html)。 – AMayes 2013-03-21 18:20:30