uitextview

How to calculate NSRange of NSString at certain position in UITextView

When I tap on a certain position in a UITextView, I want to retrieve the substring of the NSString which is shown at the line. I have e.g. a UITextView which displays a string, using 16 lines. When I tap on position (200, 150), I want the substring which is shown by UITextView on that tap. Any suggestions on how to achieve this? ...

UITextView inside UIAlertView subclass

Hi, I'm trying to put a UITextView inside a custom subclass of UIAlertView that I create using a background image of mine. The UITextView is only for displaying large quantities of text (so the scrolling). Here is the code of my subclass - (id)initNarrationViewWithImage:(UIImage *)image text:(NSString *)text{ if (self = [super init]...

unrecognized selector error when calling select: on uitextview in iOS < 3.2

i am trying to call select:(id) sender on uitextview. i do this in order to make my text selection visible, making the call before setSelectedRange. the code works just fine on OS3.2, but on OS3.1.3 and below it crashes with an unrecognized selector error. i can avoid the crash by using respondsToSelector, but naturally i'd like to fin...

textView: How to remove text when editing begins and not when firstRsponder...

The headline says it all. In my textEditView I have an textView with a lightgrey default text in it, "Context". The textView is the firstresponder. What I want to do is to remove the text when the editing begins, not when the textView becomes firstResponder. Hmmm a idea is forming in my head... could I run a check of the NSRange someho...

Insert date/time in UITextView when user hits return

Im trying to Insert the current date/time whenever the users hits the return key or starts typing on a UITextView in Xcode but not quite sure where to start. I know this method is for when clicking into the TextView but doesn't seem to work: - (void)textViewDidBeginEditing:(UITextView *)textView { self.txtDetail.text = [self.txtDet...

Drawing ruled lines on a UITextView for IPhone

I would like to create a view like the notes app on iPhone and therefor need the view to have ruled lines as per the notes app, I have done this in windows where you need to get the font metrics and then draw the lines onto the device context, has anyone done this in the UITextView if so some help would be appriciated ...

How do I set the right margin of a UITextView?

I have a vertically-scrolling UITextView that fills the width of the screen. I need the text view to have margins (contentInset) of 20 pixels on the left and the right. But for some reason, I can't get the right-hand margin to work, either in Interface Builder or in XCode. The reason I can't just make the text view narrower is because I...

UITextView Custom Auto-completion.

Is there a way to implement custom Auto-completion for a UITextView, say by giving it a NSDictionary or NSArray of Strings to watch out for? ...

Efficient use of large amounts of text in UITextView

I have a plist (array of dictionaries) with 20 items, each of the 20 dictionaries having a 'code' and 'text'; each text averages 1K bytes. The class that uses the text will use 1 of the 20, based on the 'code'. The text doesn't change so I'm keeping it in the bundle. I'd like to know if I'm doing this as efficiently as possible, basic...

iphone - view init issue

I have come across a strange behavior... In class A, at the viewDidLoad method I do: b = [[B alloc] initWithNibName:@"B" bundle:nil]; //init the B class (declared as B* b) [b setText:@"ABCDDEEE"]; //change the text of a UITextView in b note that b's view is not shown until a button is pressed. However, when I press it and go to b's v...

Replicating Style of Copy/Paste Pop-out.

How would I replicate the style of the Copy/Paste pop-out so I could put custom buttons inside it. I don't think it's a public class so how else would I do this? ...

NSUTF8StringEncoding causes file to render improperly in TextEdit/Pages, but not BBEdit/vi

I'm running into a bit of a weird issue. Whenever I create a new text file in my iOS application, I set its encoding to be NSUTF8StringEncoding. If I edit the file and input any characters with diacritics and save the changes, the diacritics render properly in some applications such as BBEdit, TextMate, cat and vi but not in others suc...

UIMenuController Custom Items.

I have created a UIMenuController and have set it a custom menu item like so: UIMenuController *menuController = [UIMenuController sharedMenuController]; UIMenuItem *item1 = [[UIMenuItem alloc] initWithTitle:@"Do This" action:@selector(item1)]; [menuController setMenuItems:[NSArray arrayWithObject:item1]]; But I wanted that object to ...

UITextView right to left text direction

Hello, I was wondering if there was any way to force a UITextView to use right to left text direction for some languages? Like Microsoft Office on a computer does. ...

Anyone know how it would be possible to change the cursor in a UITextView in iOS?

A customer has requested that they want the cursor in the UITextView to be horizontal instead of vertical. Anyone know how I might do that as there isn't any public API to modify the cursor. ...

How can a create a automatically resizing table cell for entering texts like in the iPhone's "mail" app?

I'm try to emulated something just like the "new message" page in Apple's mail app on the iphone. I've implemented it with a tableview and I've successfully gotten the "To", "CC", and "Subject" rows to behave correctly, but I'm not sure how to implement the actual message portion of the page. There are several issues that I'm having. I'...

Setting UITextView selection on tap

I've got a UITextView that is not editable by default so that data detectors show addresses and phone numbers. I'd like to be able to let the user single tap anywhere in the text view to set it editable and put the insertion point there. Unfortunately, I can't get the insertion point and a single tap just enables editing of the text vi...

UITextView: Change formatting of URLs?

I currently have a UITextView which has this property setup to detect URL's: txtTemp.dataDetectorTypes = UIDataDetectorTypeLink; The URL displays correctly, formatting in blue with an underline. I want to change the formatting of this hyperlink to a bold font style with no underline. The rest of the regular text in the UITextView nee...

Is UITextView enough for a simple writing app?

Hi, I'm trying to make a simple writing program, like Notes app for iPad, with a custom keyboard. From OmniGroup's text editor open sources, I learned that UITextInput is mainly required to develop great text editor capable of having several fonts and size in one editor. But it seemed tough to implement a lot of methods in UITextInput Pr...

Application crashes with UITextViewDelegate

Hi, I'm new to iPhone programming and Objective-C and am having some trouble with my UITextView. I have a view with a text view as its subview. I created a separate class which I want to be the delgate of the text view. In my header for this delegate class, I have the statement @interface MessageTextViewDelegate : NSObject UITextVie...