uitextviewdelegate

iOS - UITextView + NSUndoManager

北城余情 提交于 2019-12-05 18:35:25
问题 I'm trying to integrate the undo/redo features in a UITextView (I'm building a LateX editor) with no luck and to be honest I'm really confused about this argument. I don't understand the steps involved in those two operations, I mean I need two methods one to remove the last inserted text one to restore the text removed One doubt is where I get the last inserted text? in other words where I have to register for the undo? in textViewDidChange I can get the whole text in

Dynamic UITextView mislocation behavior

此生再无相见时 提交于 2019-12-05 04:07:00
I am trying to have a textview similar to iPhone messages, where the textview initially has a constraint (height <= 100) and the scrollEnabled = false This is a link to the project: https://github.com/akawther/TextView The text view increases in height based on the content size as in the image on the left until it reaches the height of 100, then the scrollEnabled is set to true. It works perfectly until I click the "send" button on the lower right where the textView should become empty and go back to the original height and scrollEnabled becomes false. The middle image shows what happens when

UITextViewDelegate behaviour when backspace key is HELD Down

我的未来我决定 提交于 2019-12-05 00:59:08
问题 I've run into a problem where iOS is giving my UITextViewDelegate incorrect information when the delete key is held on the keyboard. When the user HOLDS the delete key on a UITextView on an iPad the UITextView will begin to delete entire words instead of individual characters the longer it is held down (note: this does not occur in the simulator). When this happens, the UITextView delegate method: - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:

iOS 13.1 UITextView delegate method shouldInteract called when scrolling on attachment

半城伤御伤魂 提交于 2019-12-04 16:29:47
问题 I'm using the UITextView delegate method to do some custom work like opening a in-app browser when user tapping on URL or attachment: func textView(_ textView: UITextView, shouldInteractWith URL: URL, in characterRange: NSRange, interaction: UITextItemInteraction) -> Bool In iOS 13, this delegate method is called even when the user is just scrolling upon the URL, which is not expected. This behavior also applied to image attachment. That deleate method now is called via the interaction. *

how to insert text at any cursor position in uitextview?

孤街浪徒 提交于 2019-12-04 16:13:15
问题 i want to implement Code by which i can start to insert text at any position of cursor in UITextView in iphone sdk any idea? thank you in advance.. i refereed this link: iPhone SDK: How to create a UITextView that inserts text where you tap? But not Getting it. 回答1: Dan's answer is manually changing the text. It's not playing well with UITextView's UndoManager. Actually it's very easy to insert text with UITextInput protocol API, which is supported by UITextView and UITextField. [textView

textViewDidChange: crashes in iOS 7

谁说胖子不能爱 提交于 2019-12-04 13:29:09
问题 As we know the UITextView is more powerful in iOS 7, but here it performs more fragile. The following code works fine when inputting "rr" with Chinese input keyboard in iOS 6, but crashes in iOS 7. - (void)viewDidLoad { [super viewDidLoad]; self.tv = [[UITextView alloc] initWithFrame:CGRectMake(0, 100, 320, 100)]; self.tv.backgroundColor = [UIColor yellowColor]; self.tv.textColor = [UIColor blackColor]; self.tv.editable = YES; self.tv.delegate = self; [self.view addSubview:self.tv]; } -(void

textViewDidChange is not call when change UITextView.inputView?

折月煮酒 提交于 2019-12-04 12:53:06
I drag a UITextView and hook up delegate with File's Owner . The textViewDidChange is called only with default keyboard, but nothing happen when input text from my keyboard. How to enable delegate of UITextView when set its inputView to a custom keyboard? Here is my code ViewController.m -(void)viewDidLoad{ self.myKeyboard = [[[NSBundle mainBundle] loadNibNamed:@"MyKeyboard" owner:nil options:nil] objectAtIndex:0]; [self.myKeyboard setTextView:self.textView]; } #pragma mark TestViewDelegate - (void)textViewDidChange:(UITextView *)textView{ NSLog(@"TextDidChange: %@",textView.text); }

iOS - UITextView + NSUndoManager

好久不见. 提交于 2019-12-04 03:06:39
I'm trying to integrate the undo/redo features in a UITextView (I'm building a LateX editor) with no luck and to be honest I'm really confused about this argument. I don't understand the steps involved in those two operations, I mean I need two methods one to remove the last inserted text one to restore the text removed One doubt is where I get the last inserted text? in other words where I have to register for the undo? in textViewDidChange I can get the whole text in textViewShouldChangeTextInRange I can get the last char inserted I know that what I wrote wasn't the best explanation ever,

Detect UITextView scroll location

你说的曾经没有我的故事 提交于 2019-12-04 00:48:24
问题 I am trying to implement a form of a Terms & Conditions page where the "Proceed" button is only enabled once the user has scrolled to the bottom of a UITextView. So far I have set my class as a UIScrollView delegate & have implemented the method below: - (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView { NSLog(@"Checking if at bottom of UITextView"); CGPoint bottomOffset = CGPointMake(0,self.warningTextView.frame.size.height); //if ([[self.warningTextView contentOffset] isEqualTO

UITextViewDelegate behaviour when backspace key is HELD Down

十年热恋 提交于 2019-12-03 16:13:51
I've run into a problem where iOS is giving my UITextViewDelegate incorrect information when the delete key is held on the keyboard. When the user HOLDS the delete key on a UITextView on an iPad the UITextView will begin to delete entire words instead of individual characters the longer it is held down (note: this does not occur in the simulator). When this happens, the UITextView delegate method: - (BOOL)textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text Gets called with a range consisting of the correct cursor location, but a length of 1.