7
A
回答
0
13
兩者的標籤欄它已經有一段時間,因爲這是問,但爲了文件的緣故,這裏有: 首先,訂閱NSNotificationCenter以接收鍵盤通知:
-(void) viewWillAppear:(BOOL)animated
{
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillToggle:)
name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(keyboardWillToggle:)
name:UIKeyboardWillHideNotification object:nil];
}
不要忘記退訂
- (void)viewWillDisappear:(BOOL)animated
{
[self.view endEditing:YES];
[super viewWillDisappear:animated];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:UIKeyboardWillShowNotification object:nil];
[[NSNotificationCenter defaultCenter] removeObserver:self
name:UIKeyboardWillHideNotification object:nil];
}
然後實現將由通知中心調用的函數:
- (void) keyboardWillToggle:(NSNotification *)aNotification
{
CGRect frame = [[[self tabBarController] tabBar] frame];
CGRect keyboard = [[aNotification.userInfo valueForKey:@"UIKeyboardFrameEndUserInfoKey"] CGRectValue];
frame.origin.y = keyboard.origin.y - frame.size.height;
[UIView animateWithDuration:[[aNotification.userInfo valueForKey:@"UIKeyboardAnimationDurationUserInfoKey"] floatValue] animations:^
{
[[[self tabBarController] tabBar] setFrame:frame];
}];
這將在鍵盤的步伐動畫的TabBar,並保持它在上面。
0
我通過顯示自定義鍵盤而不是原生uikeyboard
來解決此問題。
從此github鏈接下載示例項目。
將鍵盤自定義爲所需的原生鍵盤,無論是數字還是文字。
然後將uibutton放置在自定義鍵盤下方,並使用tabbar控制器,如下圖所示的圖像。試試這個(未來人次),它可以解決這個問題。
相關問題
- 1. 隱藏鍵盤
- 2. 隱藏鍵盤
- 3. 隱藏鍵盤ios
- 4. 隱藏軟鍵盤
- 5. 隱藏IOS鍵盤
- 6. 鈦 - 隱藏鍵盤
- 7. uitextfield隱藏鍵盤?
- 8. 鍵盤隱藏BottomSheetDialogFragment
- 9. 隱藏軟鍵盤或強制改變焦點隱藏鍵盤
- 10. 軟鍵盤隱藏的EditText
- 11. 隱藏iOS中的鍵盤
- 12. Android的webview。鍵盤隱藏
- 13. 隱藏iPad的鍵盤
- 14. 隱藏iPhone上的鍵盤
- 15. 辭職急救員隱藏鍵盤,但不生成鍵盤將隱藏/鍵盤確實隱藏事件
- 16. Android鍵盤隱藏屏幕
- 17. 隱藏鍵盤/ resignFirstResponder強制
- 18. Nativescript Android - 隱藏鍵盤
- 19. 隱藏虛擬鍵盤
- 20. iPhone - 鍵盤隱藏TextField
- 21. 隱藏鍵盤和secureTextField
- 22. 可靠隱藏軟鍵盤
- 23. UIWebView隱藏鍵盤邊距
- 24. 隱藏鍵盤和按鈕
- 25. Android軟鍵盤隱藏RecyclerView
- 26. TextView與鍵盤隱藏
- 27. Android - 鍵盤隱藏editText
- 28. 用dismissViewControllerAnimated隱藏鍵盤
- 29. 隱藏軟鍵盤問題
- 30. 如何隱藏軟鍵盤?
當用戶集中在輸入的東西在搜索欄中進行搜索,你爲什麼想要顯示的標籤? – Viraj 2011-03-11 11:26:11
我還要說,是標準的行爲,你不應該改變這種狀況。 – 2011-03-11 11:37:26
@Viraj我的評論希望這樣,是不是我的錯:P – JAA 2011-03-11 11:41:19