uitextview

CGRect for selected UITextRange adjustment for multiline text?

和自甴很熟 提交于 2019-12-31 20:49:05
问题 I've used this answer in order to create a CGRect for a certain range of text. In this UITextView I've set it's attributedText (so I've got a bunch of styled text with varying glyph sizes). This works great for the first line of text that's left aligned, but it has some really strange results when working with NSTextAlignmentJustified or NSTextAlignmentCenter . It also doesn't calculate properly when the lines wrap around or (sometimes) if there are \n line breaks. I get stuff like this (this

How to resize UITextView while typing inside it?

好久不见. 提交于 2019-12-31 12:56:10
问题 I'm creating a comment section much like the one Facebook uses for it's messaging section in it's iOS app. I want the UITextView to resize the height so the text I'm typing fits inside it rather than you having to scroll to see the text that overflows. Any ideas how I might go about doing this? I've looked into maybe using a CGRect that is assigned to the size and height of the text view which then matches the content size: CGRect textFrame = textView.frame; textFrame.size.height = textView

How to Get the value(label) from the TextField inside the custom cell of a table View to post on te URL

陌路散爱 提交于 2019-12-31 07:34:51
问题 I want my iOS app to pass to a URL the text the user types. The relevant code is pasted below. WHen I run the app, the text does not get assigned any value. It stays as null. I am new to iOS programming and am probably missing something obvious here. Any help/pointers will be appreciated. Mac OS version : 10.6.8 (64 bit) Xcode version : 3.2.3 In the snapshop.. "I have created a Table View and placed custom cell inside each row of a table. TextField is inside the custom cell view. Post is a

Underline text inside uitextview

橙三吉。 提交于 2019-12-31 06:56:06
问题 How can i underline text inside uitextview programmatically? 回答1: You can use NSAttributedString for this purpose. Following is link for the same - https://github.com/AliSoftware/Ali-Cocoa-Classes And you can refer this thread to check how to use NSAttributedString. How do you use NSAttributedString? 回答2: I used UIWebView instead of UITextView to solve this problem. NSString *contentHtml = [NSString stringWithFormat:@"<html><head></head><body><font color=\"white\" size=\"4\"><table width=\

UITextView member variable is always nil in my UIViewController

冷暖自知 提交于 2019-12-31 05:42:12
问题 In my nib, I have a UITextView component. In my UIViewController I have a UITextView member field and I have used IB to make sure that the two are connected (at least I think I did that by dragging from "Files Owner" and dropping it on the UITextView in IB and selecting my member variable). Now, when I update the text via setText: , the UITextView still remains blank. When I break into my code, the member variable (called textView ) is nil . So I am guessing I have not used IB correctly. How

Get text range of link in UITextView

为君一笑 提交于 2019-12-31 03:26:48
问题 I have a UITextView that contains a link and some other text. The link detection is enabled and working (iOS8). However, I am at loss to find the range of the link within the textView. The idea is that the text is scanned (after link detection is done) and the link preloaded into a web view, so that when a user taps on an element somewhere, the web view can reveal itself. How can I get the range of the detected link within a UITextView? 回答1: A way to do it, is to use enumerateAttribute

How to avoid an error due to special characters in search string when using Regex for a simple search in Swift?

谁说我不能喝 提交于 2019-12-31 02:54:27
问题 I'm using Regex to search for a word in a textView. I implemented a textField and two switch as options (Whole words and Match case). All work fine when you enter a plain word in the search filed but I get an error when I enter a special character like \ or *. The error I get is like this one: Error Domain=NSCocoaErrorDomain Code=2048 "The value “*” is invalid." UserInfo={NSInvalidValue=*} Is there a way to avoid this problem and have the code handle all the text like plain text? Because I

Customise the quicktype suggestions in iOS Keyboard

倖福魔咒の 提交于 2019-12-30 17:26:15
问题 I want to have quicktype suggestions to have my own certain application level needed phrases as suggestions when keyboard is open in uitextview. For example if user types "All" - In quicktype suggesstion I want to show "All is well" or "All is as expected". Can I customize the quicktype suggestion text? If not, what could be other way to have this suggestions to show when keyboard is open. 回答1: Since there's no (known) way of changing the quicktype suggestions, I Subclassed UIInputView to

iOS — UITextView disable scrolling but enable touches

断了今生、忘了曾经 提交于 2019-12-30 08:01:50
问题 Is there any way to do this? What I really want is a UITextField where I can control the location of the cursor. But as far as I can tell, that is impossible. So I am looking at using a UITextView. This does allow one to control the cursor location. But scrolling is getting in the way -- my text is scrolling here and there, and I don't want that. 回答1: UITextView is a subclass of UIScrollView, so you can prevent the view from scrolling by setting the property scrollEnabled to NO . 回答2: If I

iOS — UITextView disable scrolling but enable touches

北城以北 提交于 2019-12-30 08:01:28
问题 Is there any way to do this? What I really want is a UITextField where I can control the location of the cursor. But as far as I can tell, that is impossible. So I am looking at using a UITextView. This does allow one to control the cursor location. But scrolling is getting in the way -- my text is scrolling here and there, and I don't want that. 回答1: UITextView is a subclass of UIScrollView, so you can prevent the view from scrolling by setting the property scrollEnabled to NO . 回答2: If I