In iOS Objective-C, I want to cancel the conversion work of the text input into the UITextView.

Asked 2 years ago, Updated 2 years ago, 38 views

How can I take the attached image A to B by program control?
In other words, in UITextView (it's an HTML form in the image...), I wanted to erase the unspecified input string in the markedTextRange and clear the predictive conversion of the keyboard, but I couldn't find any information.
I would appreciate it if you could keep the focus on TextView and keep the cursor position intact.

I don't put it on the image, but when the digest list that I implemented is displayed on the screen and the cell is tapped, I don't need the original OS included keyboard conversion candidate list anymore, so I want to clear it.
I'm sorry for the confusing explanation, but I'd appreciate it if you could let me know if you know the API.
Enter a description of the image here

ios objective-c

2022-09-30 15:59

1 Answers

First, in the @interface section of File's owner,

@interface Class Name <UITextFieldDelegate>{
    IBOUlet UITextField* wantsToCancelable;
}

For example, create an outlet for the text field that you want to cancel editing, and connect the outlet to access the contents.
After that, please send it to @implementation.

-(void)awakeFromNib

in
[wantsToCancelable setDelegate:self];

Alternatively, the Delete property of UITextFileld (black window that appears with left click) should be File's Owner.

Finally,

 - (void) textFieldDidBeginEditing: (UITextField*) textField
- (void) textFieldDidEndEditing: (UITextField*) textField

You can implement and check the string that is being edited inside.
Remove and set content (cancel)

[wantsToCancelable stringValue];
wantsToCancelable setStringValue: newString;

in the .To return to the blank, pass @" to the newString


2022-09-30 15:59

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.