inputview

How to change inputView of UISearchBar in iOS7?

大兔子大兔子 提交于 2019-12-13 02:16:19
问题 In iOS6 , I use the below code to change inputView of UISearchbar for (UIView *view in _searchBar.subviews) { if ([view isKindOfClass: [UITextField class]]) { UITextField* textField = (UITextField*)view; [textField setInputView:_myKeyboard]; break; } } UISearchbar in iOS7 had changed, I don't know how to find textField to change inputView. Please help! Thanks! 回答1: The hierarchy of subview has been changed in iOS7, so you can use the following code: // subviews NSArray *searchBarSubViews = [

Prevent editing of text in UITextField and hide cursor/caret/magnifying glass while using an inputView

放肆的年华 提交于 2019-12-12 07:46:24
问题 How do I prevent the editing of text in a UITextField along with hiding the cursor/caret/magnifying glass, but still present the keyboard, as I am using an inputView with a UIPickerView / UIDatePickerView ? Setting userInteractionEnabled to NO does not work, because it no longer receives any touches and will not present the keyboard. 回答1: Subclass UITextField //Disables caret - (CGRect)caretRectForPosition:(UITextPosition *)position { return CGRectZero; } //Disables magnifying glass -(void

Custom InputView for UISearchBar doesn't work in iOS7

浪子不回头ぞ 提交于 2019-12-12 07:20:06
问题 I need to set my custom inputView in UISearchBar. So i wrote following codes , that is working perfectly in iOS5 and iOS6 . However it doesn't work in iOS7. for(int i =0; i<[self.searchBar.subviews count]; i++) { if([[self.searchBar.subviews objectAtIndex:i] isKindOfClass:[UITextField class]]) { [(UITextField*)[searchBar.subviews objectAtIndex:i] setFont:[UIFont fontWithName:@"MyCustomFont" size:15]]; UITextField* search=(UITextField*)[searchBar.subviews objectAtIndex:i]; search.delegate =

iOS: Customise UITextField's inputView size

ぐ巨炮叔叔 提交于 2019-12-10 14:54:54
问题 I need to customise the size of UITextField's inputView . My custom view that is assigned to inputView is already a size of 260x220 but still inputView appears as 260x768( Portrait ) and 260x1024( Landscap ). I tried changing inputView's Frame but still no change. Is there anyway I can modified UITextField's inputView Frame so that it only occupies certain space in bottom screen? textField.inputView = numPadViewController.view; [textField.inputView setFrame:CGRectMake(0, 0, 260, 220)]; [EDIT]

How to show keyboard after used inputView

╄→尐↘猪︶ㄣ 提交于 2019-12-09 10:50:02
问题 I used inputView to show uipickerview for my textfield , but I use same textfield for other functions. How can I show standard keyboard after I used inputView for that textfield ? textfield.inputView = pickrView; 回答1: Just textfield.inputView = nil; worked for me 回答2: As Pavel Kaljunen said, you need only to set the inputView to nil, but when the keyboard is already visible, you have to resignFirstResponder first, set the inputView to nil and then becomeFirstResponder again. [UIView

UIsearchBar input Keyboard Type

﹥>﹥吖頭↗ 提交于 2019-12-08 12:55:41
问题 Does anyone know how to change the input keyboard type for the searchbar? The code searchController.searchBar.inputView = input doesn't work like in a text field. I have read that the subview of the searchBar is a textfield but I don't know how to access that subview to change the inputView. 回答1: I think you want to display different keyboard than standard, Make sure you have assign delegate to keyboard. class ViewController: UIViewController, UISearchBarDelegate, KeyboardDelegate { @IBOutlet

Custom input view as keyboard for textfield in Swift using OSX 10.9 and Xcode 6.1.1 +

烂漫一生 提交于 2019-12-07 10:01:28
问题 I am having trouble with connecting buttons after I load a custom input view keyboard. My main screens are storyboard and my custom view is a xib. The input view is a nib with the file owner pointing to its swift class. I am loading the input view with code in another view controller using: extension UIView { class func loadFromNibNamed(nibNamed: String, bundle : NSBundle? = nil) -> UIView? { return UINib( nibName: nibNamed, bundle: bundle ).instantiateWithOwner(nil, options: nil)[0] as?

How to stop my Custom Keyboard from 'floating' or being undocked on iPad

↘锁芯ラ 提交于 2019-12-06 17:27:32
问题 I have a custom Keyboard that gets displayed for a certain UITextField when I set the textField's inputView to my KeyboardView. The keyboard works fantastically well but it has become apparent that the keyboard will 'float' if the user has previously undocked the built in Apple Keyboard or indeed split it. I have searched for many hours for a way to ensure my custom keyboard does not act like this and instead stays docked to the bottom of the screen regardless as to whether the user has

UISearchBar with InputView

拜拜、爱过 提交于 2019-12-06 06:58:05
问题 I'm making custom keyboard for my app and it's working fine with UITextField. But UISearchBar don't support inputView - (UIView *)inputView { if(self.keyboard==nil) { self.keyboard=[[[MMKeyboard alloc] initWithNibName:@"MMKeyboard" bundle:nil]autorelease]; } NSLog(@"HERE"); return self.keyboard.view; } How to replace with my custom UITextField in UISearchBar or how to implement inputView in UISearchBar ? 回答1: As this code is doing but you instead change the inputView : // loop around subviews

Disable Keyboard for UITextfield

匆匆过客 提交于 2019-12-06 01:40:26
I'm wondering how to disable the inputview of a UITextfield. Setting textField.inputView = nil; or [textField setInputView:nil] in ShouldBeginEditing doesn't do anything, and using the userInteraction property removes the ability to interact with the field. Ideally, I'd like to remove both the cursor and the keyboard while still being able interact with and switch between textfield methods, using ShouldBeginEditing and ShouldEndEditing. Is there any way to accomplish this? You should do this: myTextField.inputView = UIView.new; //Empty UIView Setting it to nil just means the default keyboard