how to hide keyboard of textview even though if the editing mode enabled [duplicate] - uitextview

How to hide/disable keyboard ,if the textview editing is enabled.
I only want to that user can only be able to select the text and can't be allowed for entering text.
Because selected text will be converted in to image for move animation.
User will not be allowed for entering any text in textview so that's why keyboard should be hidden or disable ,he will be allowed only for text selection.

uitextview.editable = NO; or set checkmark in IB. It will allow to select text with options - Copy and Select All without keyboard appearing. Tap on the word and hold to select text.

ok just uncheck the behavior of you UItextview in .xib file.

Something to try it the 'editable' setting doesn't work out is to create a UIView that's hidden and out of the way somewhere and assign it as the inputView for the text view. If that property is non-nil, the view it contains will be shown instead of the keyboard.
Such as:
self.textView.inputView = [[[UIView alloc] initWithFrame:CGRectMake(0, 0, 1, 1)] autorelease];

try this
yourtextview.UserinterationEnable=No;

This will make the keyboard disappear:
[[[UIApplication sharedApplication] keyWindow] endEditing:YES];
This what you want to do?

Related

Android Studio Widget, Text Field, Large, Medium and Small Text is missing all I have is Plain which gives a Name. How can I get it and others?

I'm looking at Youtube examples and I see the instructor has Widgets I don't have, Like different size Text Fields and an analogue clock.
Is there somewhere I can get more Widgets?
I obtained a text size same as to the "tutorial" using:
android:textAppearance="#style/TextAppearance.AppCompat.Large"
Looks like AndroidStudio has undergone some change. Best option is to enter the "Text" mode and type the style yourself. For ex. if you need an equivalent of LargeText view, then add a TextView and move onto the Text mode and add this line:
android:textAppearance="#style/?android:attr/textAppearanceLarge"
Or you could also edit the properties of TextView too.
You should add this line android:textAppearance="#android:style/TextAppearance.Large"
inside the TextView after clicking on the Text tab near Design tab located in the middle left to the right of design tab.
but you have to consider that first of all you need to drag and drop TextView from Widgets into the user interface or Design section.
Click into the Text tab located middle left to the right of the Design tab, find the TextView element and within it simply enter this line of code:
style="/?android:attr/textAppearanceLarge"
Remember this line of code has to be within the element in order for it to work.
Go to properties and then select text appearance and select app.
combat.large
Use this:
android:text="Large Text"
android:textAppearance="?android:attr/textAppearanceLarge"
Add it inside your Textview tag.

A keyboard with a UITextField

I have a table listing some strings, and what I want is when I tap the add button on the navigation bar, a keyboard with a textField would jump up, so I can input a string in the textField, then when I tap the return key, the keyboard disappear as well as the textField, and the new string is added to the table.
I already make up a nib file with a toolBar containing a textField, and I just failed to go on.
How can I implement this idea? Use the inputAccessoryView? If so, that means the inputAccessoryView of the textField which belongs to the toolBar is gonna be the toolBar itself!
This seem kind of weird and I have not been able to make it work till now.
Or is there another way for this idea?
Thanks a lot!
I've solved the problems by using notification instead of inputAccessoryView.
There is a sample code in XCode called "KeyboardAccessory", and it gives a good example about using keyboard notifications!
Or custom a view with a tab, and set it as the textField's inputAccessoryView, that would also work!

UITextfield selection of all text at becomeFirstResponder

I need to highlighted all text in uitextfield when it become first responder. and user press any key the textfield will become blank and user can enter new text.
[m_titleTextField selectAll:self];
[UIMenuController sharedMenuController].menuVisible =YES;
This code is not working...
I have fixed this problem,
use the same one but put into right place.
[m_titleTextField selectAll:self];
[UIMenuController sharedMenuController].menuVisible =YES;
use in - (void)textFieldDidBeginEditing:(UITextField *)textField delegate method of UITextfield...

inputAccessoryView not hide the view when -resignFirstResponder?

I have attached a toolbar with a UITextField and UIButton to the keyboard when it becomes the first responder via the user taping inside the textfield
textField.inputAccessoryView = theToolbar;
Problem is, the toolbar disappears when the keyboard is dismissed, thus preventing any further input.
Any ideas on how to make the toolbar go back to the bottom of the screen rather than off it completely?
I'm thinking a delegate method might help but Im really not too sure. It seems once the inputAccessoryView always the inputAccessoryView :(
Cheers
The input accessory view is automatically dismissed with the input view (the keyboard, in this case). Generally you do not want to have an input accessory view in your view hierarchy. Instead, if you want your toolbar to scroll up when the keyboard is shown, you should follow the guidelines for Managing the Keyboard.
You could try using an additional toolbar that is offscreen as the inputAccessoryView, which could "fake" the appearance of what you are trying to do. Alternatively, have you tried adding the toolbar back to the bottom of the screen using
[self.view addSubview:theToolbar];
when the keyboard reaches the bottom of the screen? You can use keyboard notifications for this.

Remove selection from initialized text (Deselect) in CEdit control

I have CEdit control and I don't want any text to be selected by default. I tried using
m_txtURL.SetSel(-1, 0, TRUE);
to remove the selection, but to no avail. can some one suggest a way to do achieve that?
I tried to select some characters using the following coding. That too did not work.
m_txtURL.SetSel(-1, 0, TRUE);
Can someone tell me what the problem could be?
Now I am able to deselect the text in the Edit control. The edit control, I am using is the first control in the Dialog box, so the by default the first control in the dialog box has been set to focus. From developers' reference:
If OnInitDialog returns nonzero,
Windows sets the input focus to the
first control in the dialog box. The
application can return 0 only if it
has explicitly set the input focus to
one of the controls in the dialog box.
No what I have done is:
BOOL CIegSettingsDlg::OnInitDialog()
{
CDialog::OnInitDialog();
return FALSE; // return TRUE unless you set the focus to a control
}
By this we indicate to dialog box that, we would take care of focussing a control.
The question is why is your text selected by default?
Subclass it using DDX_Control(pDX, IDC_EDIT1, m_txtURL)
Set the text m_txtURL.SetWindowText(_T("just some text")) in OnInitDialog
Nothing should be selected.

Resources