uitextview

Recognize special characters in NSString

我与影子孤独终老i 提交于 2020-01-02 20:03:08
问题 I have a UITextView with text: 🅰🅱🍉👌📧🎏❡ its image: ( This is screen shot of my text, I worry somebody can not see my special character ) If I am an end-user , I just see that there are only 7 characters on textView. But [textView.text length] = 13 I want to split this text into an array like this: array = @[ , , ,... ] But I can't detect where is, where is, where is ... :( Could you help me! 回答1: Characters outside of the "basic multilingual plane" - in other words, characters whose Unicode

Detect linebreak in UITextView

可紊 提交于 2020-01-02 14:15:40
问题 Is there a way to detect line breaks occurred by the user or when the textview automatically changes line. I am going to change the height of the textview depending on the number of lines. Any help appreciated. 回答1: You can use the method proposed in this answer to find the occurrences of @"\n", the newline character. You can see if the string change using the textViewDidChange: protocol method (apple doc here). If you want the heigh, directly, look at this answer. I think it can help. 回答2:

UITextview typingAttributes not working

那年仲夏 提交于 2020-01-02 13:55:11
问题 I have UITextView and I want to set it's line height to 50.0f so I'm using typingAttributes, but nothing works, my code goes like this in ViewDidAppear Method UITextView *textView = [[UITextView alloc]initWithFrame:CGRectMake(0, 0, 300, 300)]; NSMutableParagraphStyle *paragraphStyle = [[NSMutableParagraphStyle alloc] init]; paragraphStyle.minimumLineHeight = 50.0f; paragraphStyle.lineHeightMultiple = 50.0f; paragraphStyle.maximumLineHeight = 50.0f; NSDictionary *textViewAttributeDic =

iOS - NSNotificationCenter multiple UIKeyboard notification

北城余情 提交于 2020-01-02 13:50:15
问题 I have two view controllers let's call them A and B (1) in A I show a popOver containing a textField (2) in B there is an UITextView used for simple text editing I Have to manage the keyboard in A and in B to scroll the content hidden by the keyboard. I know how to reposition the content. What I need is a way to have different behavior on the same notifications types that in my are UIKeyboardWill(Show/Hide)Notification. What I've done so far : (1) I've added this code in each controller [

ios - How to add checkbox list to UITextView

那年仲夏 提交于 2020-01-02 11:02:11
问题 I am building a Rich Text Editor, similar to the Notes app on the iPhone and I wanted to know how can I add a checkbox list inside the UITextView? I assume this can be done using NSTextAttachment but how do I add the tap functionality to check \ uncheck the image? 回答1: Ok so i solved this using HPTextViewTapGestureRecognizer It appears to do a good job handling tap actions for text attachments 来源: https://stackoverflow.com/questions/36297812/ios-how-to-add-checkbox-list-to-uitextview

ios - How to add checkbox list to UITextView

流过昼夜 提交于 2020-01-02 11:00:13
问题 I am building a Rich Text Editor, similar to the Notes app on the iPhone and I wanted to know how can I add a checkbox list inside the UITextView? I assume this can be done using NSTextAttachment but how do I add the tap functionality to check \ uncheck the image? 回答1: Ok so i solved this using HPTextViewTapGestureRecognizer It appears to do a good job handling tap actions for text attachments 来源: https://stackoverflow.com/questions/36297812/ios-how-to-add-checkbox-list-to-uitextview

ios - How to add checkbox list to UITextView

心已入冬 提交于 2020-01-02 11:00:11
问题 I am building a Rich Text Editor, similar to the Notes app on the iPhone and I wanted to know how can I add a checkbox list inside the UITextView? I assume this can be done using NSTextAttachment but how do I add the tap functionality to check \ uncheck the image? 回答1: Ok so i solved this using HPTextViewTapGestureRecognizer It appears to do a good job handling tap actions for text attachments 来源: https://stackoverflow.com/questions/36297812/ios-how-to-add-checkbox-list-to-uitextview

How should I get my inputAccessoryView to resize when rotating device?

半城伤御伤魂 提交于 2020-01-02 02:40:47
问题 I'm attaching a UIToolbar to my UITextView as its inputAccessoryView in order to add a button to dismiss the keyboard. This works great and it looks correct when the device is in portrait mode. But I'm having trouble figuring out how to resize the toolbar to the lower height used for toolbars when the device is in landscape mode. I'm adding the toolbar in my text view's delegate's -textViewShouldBeginEditing: method: if (!textView.inputAccessoryView) { UIToolbar *keyboardBar = [[UIToolbar

boundingRectWithSize does not respect word wrapping

牧云@^-^@ 提交于 2020-01-02 01:11:51
问题 I create a UITextView, add text to it, and put it in the view (with a container) UITextView *lyricView = [[UITextView alloc] initWithFrame:screen]; lyricView.text = [NSString stringWithFormat:@"\n\n%@\n\n\n\n\n\n", lyrics]; [container addSubview:lyricView]; [self.view addSubview:container]; I then get the size of it for use with a button and add it to the UITextView CGRect size = [lyrics boundingRectWithSize:CGSizeMake(lyricView.frame.size.width, MAXFLOAT) options

How to know when UITextView became first responder

99封情书 提交于 2020-01-01 23:10:56
问题 How to handle when uitextview became first responder. I have text in text view and I want when the view became active want to clear the text. How can I do that? Thanks in advance 回答1: You can definitely use a UITextViewDelegate method of: - (BOOL)textViewShouldBeginEditing:(UITextView *)textView Just return YES and intercept inside that method. You can also do it for UITextFields with UITextFieldDelegate and: - (BOOL)textFieldShouldBeginEditing:(UITextField *)textField Hope that helps. 回答2: