uitextview

UITextview show vertical scrollbar all the time

╄→гoц情女王★ 提交于 2020-04-10 06:02:08
问题 I am trying to show vertical scrollbar on uitextview at the beginning with the code but it isn't doing so. UITextView *txtView=[[UITextView alloc]initWithFrame:CGRectMake(10, 80,self.view.frame.size.width-20,self.view.frame.size.height/2)]; [txtView setEditable:NO]; [txtView setSelectable:NO]; [txtView setText:self.secret]; [txtView setBackgroundColor:[UIColor clearColor]]; [txtView setTextColor:[UIColor whiteColor ]]; [txtView setFont:font]; txtView.showsVerticalScrollIndicator=YES; [txtView

How to remove lookup & share from textview in Swift 3

跟風遠走 提交于 2020-03-19 06:34:35
问题 I can remove cut, copy, paste, select, select all using this override public func canPerformAction(_ action: Selector, withSender sender: Any?) -> Bool { if action == #selector(copy(_:)) || action == #selector(paste(_:)) || action == #selector(selectAll(_:)) || action == #selector(cut(_:)) { return false } return super.canPerformAction(action, withSender: sender) } But I can't remove lookup & Share Can anyone please suggest me how to remove this? 回答1: // Make sure override func

How to set font weight as light, regular in Android

自闭症网瘾萝莉.ら 提交于 2020-02-26 11:08:08
问题 I have 3 text views. I need to set their weight as Light, Regular and Condensed. Can someone help me on how to achieve this in Android? 回答1: Use android:textStyle on a TextView to set the text style like bold , italic or normal. Here is an example of a TextView with a bold text style: <TextView android:id="@+id/hello_world" android:text="hello world" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textStyle="bold"/> If you want to use light or condensed, you

replace layout manager of uitextview

时光毁灭记忆、已成空白 提交于 2020-02-15 08:23:12
问题 NSTextContainer on Mac OS X has a method replaceLayoutManager: to replace the NSLayoutManager of NSTextView with a subclass of NSLayoutManager. Unfortunately iOS doesn't have such a function. I tried a combination of these lines of code, but it keeps crashing. THLayoutManager *layoutManager = [[THLayoutManager alloc] init]; [layoutManager addTextContainer:[self textContainer]]; // [[self textStorage] removeLayoutManager:[self layoutManager]]; //[[self textStorage] addLayoutManager

How to set position of an icon added in UITextField?

戏子无情 提交于 2020-02-05 08:14:26
问题 The email icon and placeholder text are hugging each other. I want to add some space between them. Below is the code I am using to create these fields. // view for fields background var view = UIView(frame: CGRectMake(35, 300, 300, 90)); view.backgroundColor = UIColor.whiteColor(); view.layer.cornerRadius = 5.0 // email text field var email = UITextField(frame: CGRectMake(0, 0, 300, 50)); email.backgroundColor = UIColor.whiteColor(); var emailIcon = UIImageView(); var emailIconImage = UIImage

How to set position of an icon added in UITextField?

China☆狼群 提交于 2020-02-05 08:12:41
问题 The email icon and placeholder text are hugging each other. I want to add some space between them. Below is the code I am using to create these fields. // view for fields background var view = UIView(frame: CGRectMake(35, 300, 300, 90)); view.backgroundColor = UIColor.whiteColor(); view.layer.cornerRadius = 5.0 // email text field var email = UITextField(frame: CGRectMake(0, 0, 300, 50)); email.backgroundColor = UIColor.whiteColor(); var emailIcon = UIImageView(); var emailIconImage = UIImage

UITextView gesture tap recognizer not working after text begins to edit

你离开我真会死。 提交于 2020-02-04 07:47:26
问题 I am setting up a UITextView with a tap gesture recognizer so that I can do various things after the textView is tapped. For one I want the text view to be the "selected" view after it is tapped, like so: selectedTextView = (UITextView *)recognizer.view; It works, except that after the text view goes into text edit mode, reveling the keyboard and allowing text editing, thereafter my custom tap gesture recognizer no longer works. Any way around this? 回答1: You might just need to return YES for

UITextView gesture tap recognizer not working after text begins to edit

一个人想着一个人 提交于 2020-02-04 07:47:04
问题 I am setting up a UITextView with a tap gesture recognizer so that I can do various things after the textView is tapped. For one I want the text view to be the "selected" view after it is tapped, like so: selectedTextView = (UITextView *)recognizer.view; It works, except that after the text view goes into text edit mode, reveling the keyboard and allowing text editing, thereafter my custom tap gesture recognizer no longer works. Any way around this? 回答1: You might just need to return YES for

How to delete single characters in an UITextView

女生的网名这么多〃 提交于 2020-02-01 07:34:21
问题 I have an UITextView which is for instance 380 characters in length: NSLog(@"aTextView.text lenght %i", aTextView.text.length); I now want to go through this text (backwards, char by char) and delete all characters which come before the last space (e.g. if the last words were "...this is an example", it want to reduce the string to "...this is an ": for (int i = aTextView.text.length-1; i > 0; i--) { NSString *checkedChar = [NSString stringWithFormat:@"%c", [aTextView.text characterAtIndex:i]

How do you make a UITextView detect link part in the text and still have userInteractionDisabled?

送分小仙女□ 提交于 2020-01-28 09:19:12
问题 I have a textView that is layered on a tableView cell. I need the user to click on the tableView row to open a viewController but if the textView has a link it must be clickable and that's it, no copy, select etc. If I allow user interaction like this: textView.userInteractionEnabled=NO; textView.dataDetectorTypes =UIDataDetectorTypeLink; the didSelectRowAtIndexPath is not called and I understand why but how to achieve this? EDIT: What I'm looking for is the ability to specifically identify