Autocorrection words at the top of UITextView - objective-c

I have a UITextView and I need to show the autocorrection words suggested by apple at the top. Right now they are coming at the bottom and are hiding behind the editor. Any suggestions?

Use this for the predictive text
[myTextField setAutocorrectionType:UITextAutocorrectionTypeYes];

Related

Pixate background-image no-repeat?

I am trying to put a background image into a text-field (it's just a search icon). And it is tiling the image in the text field. Is it possible to turn off the repeating of the image? i don't see anything like that, i'm seeing padding and position for background images but nothing to turn off the tiling of the image. is this not possible in pixate yet?
thanks!
You should be able to set background-size to the size of your text-field so it won't have anything to repeat.
I battled this same problem, and in the end, I found I got what I wanted by using multiple objects. Even if you get the search icon to work right, you're probably going to notice the UITextField doesn't pad the text away from the icon.
Anyway, here's how I ended up doing it so that I had full control over the style.
So you can put your search icon in the UIImageView and then define your text field's style (border, background color, etc.) with the UIView. The UITextField ends up being plain white/transparent, and positioned so that its text doesn't overrun the search icon.
I hope that helps.

How to change the text position inside UITextView

Is there away to change the postion where text in UITextView displayed. for example, i need the text to appear near the bottom of the UITextView.
I Don't know surly that i am right or not ??? but you need to use the contentOffset property of the UITextView class to accomplish this
For get more information refer this documenttation.
why not using an other view and placing the UITextView on top of that? so you can decide where to place it.
Maybe change the bounds, for the text to display at the bottom :)

Tips on implementing a custom UITextView interface on the iPhone?

I am trying to implement a control to edit text that will display the text in multiple colors. None of the solutions I have attempted yet have been good enough.
UITextView cannot accomplish this. All of the text must be the same color.
Using CoreGraphics to draw the text does not allow the text to be selected.
Using a UIWebView, DIV and PRE tags cannot be set to contentEditable on Mobile Safari.
Currently playing with using an off-screen TEXTAREA and an on-screen DIV to show the rendered text. This works pretty well, except supporting all of these at the same time seems impossible: click-to-type, click-to-move-cursor, click-and-hold-select/copy/paste.
Anyone have any tips on this predicament?
I've been trying to find any preexisting library out there that will accomplish this in a good way, to no luck. I'm open to any ideas!
Well, just pulling an idea out of my... let's say hat.
Could you put a transparent UITextfield over a view that draws the text? If the background was clear and the text color was clear the user could not perceive it but it should still respond to all commands. As the user enters and edits text you could draw the results on the view underneath.
I think the selection would work without any modification at all. When the user selected the clear text, it should create the illusion of selecting the drawn text automatically.
Like this one? StyledText http://three20.info/gfx/overview/styledtext.png It's in Three20 .
Here is an idea. I have no idea if it would work.
If you are only using colors, and not styles, the a UIWebView with colored text might layout text in exactly the same way as a UITextView. You could put a UITextView with invisible ink (text and background fully transparent) over a UIWebView and mirror the contents with colors in the html. I assume you can do scrolling with javascript along with the colored layout.

Is there a way to change color of just part of a string inside a UILabel?

Say I wanted to have the first six characters in black and the next six characters in blue, then the last 20 characters in black of a UILabel. Is this possible?
Thanks!
In Big Cocoa you would use an NSAttributedString in a NSTextField or NSTextView. In Cocoa Touch you use a UIWebView to display rich text.
Zynga has done a lot of the heavy lifting for you on this one, check out Font Label on GitHub.
As Darren said, NSAttributedString is not supported on the iPhone but you could use a UIWebView.
Another possible solution might be to draw the text using NSString's -drawAtPoint:withFont: method (or similar). You could subclass UILabel and do the drawing in -drawRect:.
First, set the color to black and draw the first six characters. Note the width that -drawAtPoint:withFont: returns, and use it to calculate the starting point for the next six characters. Change the color, draw those characters, and then repeat the same for the remainder of the string.
Note that -drawAtPoint:withFont: doesn't do line breaks and stuff like that, so it could quickly get more complicated than what I've described.
Have a look at the NSString UIKit additions.
Give TTTAttributedString a try. It's a drop-in replacement for UILabel that renders NSAttributedStrings like a champ.
You want an NSAttributedString.

Getting Justified Text in UITextField

How do I get justified text with UTTextField. It does have an textAlignment property. But the UITextAlignment constant only has left, right, and center justification.
What I am seeking is the Justified text common in word processing app with text flush with both left and right edges. This is a read only text field.
I have seen it in few iPhone apps. So it seems I am missing something.
It's a bit of an overkill maybe, but one way seems to be to use a WebView for it and style the text with CSS.
UILabel and UITextField do not support full-justified text. If you want it for a UITextField, you would have to create a subclass of UITextField and override drawTextInRect:, splitting the text into words and using sizeWithFont: to figure out how to space them along each line.
I cannot imagine what would be worth the trouble.