UILabel can't become first responder and show inputView in UITableView - ios

I tried to create a subclass of UILabel called EditableLabel and implemented canBecomeFirstResponder, isUserInteractionEnabled, both of those two methods return YES, in the meantime, I over-write inputView and inputAccessoryView and make them writable.
My problem is that when I tap on the label, the inputView can't be shown on the screen. Anybody know how to implement the subclass of UILabel view and let the inputView shown?
Thank you very much.

Why not just use a UITextField and set its borderStyle to UITextBorderStyleNone?

Related

Not properly add inputAccessoryView for UITextField

There is a requirement of inputAccessoryView is for the chat application.
When I add inputAccessoryView to UITextField on tap event of UIButton. That view is set as inputAccessoryView completely but text field is not becoming first responder.
(Note: Super view of textfield is viewText.)
- (IBAction)btnOpenTextField:(id)sender
{
UIView *accessoryView=[[UIView alloc]init];
accessoryView.frame=CGRectMake(0,0, _viewText.frame.size.width, _viewText.frame.size.height);
[accessoryView addSubview:_viewText];
_txtMessage.inputAccessoryView = accessoryView;
[_txtMessage becomeFirstResponder];
}
Thanks in Advance.
You can call [_textMessage reloadInputViews], replacing [_text becomeFirstResponder].
What you want to achieve is quite not possible, this will cause recursion, alternatively what you can do is put a textfield on bottom of the screen and when the textfield is selected you can animate it up with the flow of the keyboard. i think this is an appropriate solution if i got your question correctly.

How to set keyboard as inputview in UItextfiled

I have one UItextfiled and in viewdidload i set his input view property as nil like this.
textField.inputView = nil
In in my view i have one button when i click on the button i have to set the textfield's inputview property as keyboard how can i do this.please help me.
I'm not exactly sure what you want to do, but probably you want your textField to became active, with a keyboard. That is done with
[textField becameFirstResponder];
and other way around is
[textField resignFirstResponder];

UITextField as child of it's own inputAccessoryView

I'm attempting to duplicate a UI similar to Messages. I have a UIToolbar pinned to the bottom of the view in a xib. On that toolbar is a UITextField. I've set the UITextField's input AccessoryView to be the UIToolbar. When I click on the UITextField, it snaps into position, but there's no keyboard underneath, just blank as if the keyboard was hidden. When I click on the UITextField a second time it animates with the keyboard. I've attempted to become it's delegate and all the other suggestions in other SO posts, but no luck.
#implementation ChatViewController {
IBOutlet UIToolbar *_keyboardAccessory;
IBOutlet UITextField *_textField;
}
- (void)viewDidLoad {
[super viewDidLoad];
[_textField setInputAccessoryView:_keyboardAccessory];
}
It will be simpler if you don't try to make the toolbar be the text field's inputAccessoryView. Just animate the toolbar up with the keyboard appears, and down when it disappears.
Everything you need to know to do this animation is documented in “Managing the Keyboard” in the Text, Web, and Editing Programming Guide for iOS. You can also find answers on stack overflow describing the process. here is an answer describing the process step-by-step with all the code.

How To Stop keyBoard Appearence at click event on UITextview?

In my IPad Application i am using TextView only for Text Displaying.As i need to display a Larger Text Thats Why i am using UITextview due to its Scrolling Property instead of using UILabel.
In my application i do not need to edit Text in UITextview ,but problem for me is that when i click on Textview for scrolling the keyboard appear its hide my textview so i want that my keyboard is never appear on click event.i make a search but not find any Suitable solution.Any help will be appriated.Thanx
NEW ANSWER (previous one was not working properly)
OK so since that is not working because it disables scrolling also, you should try to:
Implement UITextFieldDelegate protocol
In your view controller add the text
#interface YourViewController () <UITextViewDelegate>
In viewDidLoad set yourself as a delegate:
yourUITextView.delegate = self;
Implement the delegate method below:
- (BOOL)textViewShouldBeginEditing:(UITextView *)textView
{
return NO;
}
When the textview is about to edit the text, this method will be called automatically. It returns no, so the editing won't start.
It is very important that you undo the changes from the previous answers: Do not set the editable field to NO
I tried it and it's working. Hope it helps!
OLD ANSWER
when you declare the variable, or in your viewdidload method, set the editable property to NO:
yourUITextView.editable = NO;
or
[yourUITextView setEditable:NO]
That should prevent the keyboard from appearing.
Go to .XIB file and you can uncheck behavior editable or programmatically
textView.editable = NO;

Use bubbles in UItextfield for auto-complete

Is there any method to use bubbles programmatically for give suggestions in UITextfield.
You can use autocorrectionType for UITextField.
yourTextField.autocorrectionType = UITextAutocorrectionTypeYes;

Resources