iPad keyboard will not dismiss if modal view controller presentation style is UIModalPresentationFor
在ipad上present 一個 navigation controller 時,present後彈出的keyboard,不能夠 dismiss 掉。即使 textfield resignFirstResponder,keyboard也不會消失。
Problem:
在iPad keyboard上發現一個問題,當viewController在navigation controller下以模態檢視彈出,並且navigationController.modalPresentationStyle = UIModalPresentationFormSheet時,點選done按鈕,軟鍵盤不撤銷,即使 textfield resignFirstResponder了。
Solution:
當模態檢視在 UINavigationControlle下顯示,我們需要設定 navigation controller的disablesAutomaticKeyboardDismissal屬性,我們可以通過新增類別實現這個。
File: UINavigationController+KeyboardDismiss.h
#import
@interface UINavigationController (KeyboardDismiss)
- (BOOL)disablesAutomaticKeyboardDismissal;
@end
File: UINavigationController+KeyboardDismiss.m
#import "UINavigationController+KeyboardDismiss.h"
@implementation UINavigationController(KeyboardDismiss)
- (BOOL)disablesAutomaticKeyboardDismissal
{
return NO;
}
@end
在需要用到的ViewController檔案中匯入建立的類別即可。
相關文章
- bootstrap modal的data-dismiss屬性boot
- 詳解 View ControllerViewController
- Controller和View物件的載入ControllerView物件
- SlugDungeon Apple Model-View-ControllerAPPViewController
- iPad 多工 Spilt View & Size ClassiPadView
- objc系列譯文(1.4):View Controller 容器OBJViewController
- dto= Presentation Model?
- Multimedia presentation
- 解決 iOS View Controller Push/Pop 時的黑影iOSViewController
- java web mvc-01-Model-View-Controller 概覽JavaWebMVCViewController
- 關於自定義檢視容器(Container View Controller)AIViewController
- Windows Presentation Foundation 安全沙箱Windows
- Windows Presentation Foundation資源Windows
- Windows Presentation Foundation慨述Windows
- WPF style BasedOn base style
- iOS:Managing the KeyboardiOS
- objc系列譯文(12.3):自定義View Controller容器轉場OBJViewController
- 【除錯技巧】Dialog dismiss 崩潰除錯
- MVC3.0 不同view層,呼叫相同Controller方法,但引數不同MVCViewController
- 日記(react modal)React
- langchain multi modal supportLangChain
- Iterm2 keyboard shortcut
- Keyboard Shortcuts for the KDE Desktop
- 自定義Push/Pop和Present/Dismiss轉場
- 自定義present和dismiss的轉場動畫動畫
- Presentation Helper for Mac(桌面演示工具)1.8Mac
- .NET專家談Windows Presentation FoundationWindows
- Bootstrap模態框(Modal)boot
- bootstrap modal垂直居中 (轉)boot
- LLM multiple modal applicationsAPP
- SAP UI5和CRM WebUI的View和Controller是如何繫結的UIWebViewController
- C2. Adjust The Presentation (Hard Version)
- Laravel 控制器 Controller 傳值到 檢視 View 的幾種方法總結LaravelControllerView
- Keyboard Maestro for Mac鍵盤大師Mac
- Sublime: how to overwrite the Emmet plugin keyboard shortcutsPlugin
- AntDesignBlazor示例——Modal表單Blazor
- Ruby Code & Style
- 關於Presentation Error的一點經驗Error