use tableview as uitextview - iphone

i want to develop a application like notepad app of iphone or ipod. i try my level best to design a uitextveiw like a paper with lines but it has a lot of problems like background image does not scroll with scroll of uitextview. and does not reapeat itself when text increases the background image.
its seems to me that the notepad app use a table view for taking input from user how i donot know.
so anyone who can tell me how to design a view like notepad app.

use a tableview and then place text field in each row such that if the text field limit reach the maximum length the next row text field become first responder. and when user click save then read data from all text field and then save it where u want.
but the only problem that i am facing is when the user past some data then i am unable to show that data in next text field if the past data is larger than the maximum length of a text field.
hope this help others.

Related

how to add custom label view to uitextview?

I am developing one message application in ios for iPhone .
i have one textview in which i have to write name of persons and on input space in uitextview i have to show the previously entered content in different text with different background .let me explain with image!
can anyone help me how can i achieve this kind of thing in my text view with CROSS MARK and on click of Cross Mark I want to delete that bubble?
so when user inputs the space after write some string in textview then it will convert with following view in green background with cross button..
You want to use some type of token field. Search github. Something like this.

Scrollable view with text and ability to do something when specific phrase is tapped

I am trying to implement a view which will load text from sqlite database (every sentence in a text will have unique tag in database) and will allow to execute some code while sentence is clicked (on-click executed method should then scroll clicked sentence to the center of the screen and change it's color/background color/font size to emphasize it)
Is it possible without using webview and js/js-native bridge? Which approach should be taken to implement such a view? Any help and comments highly appreciated!
Hmm, you could also considering using NSAttributedString together the Core Text Framework and attribute each sentence and attach some extra info about. Next you lookup the attribute below the tap position of the view. Once you have that you can retrieve the extra info again and do whatever you want with the tap.
After the tap you could then alter the properties of that part of the text. E.g. different font colour etc.
This tutorial on the internet looked interesting:
http://www.raywenderlich.com/4147/how-to-create-a-simple-magazine-app-with-core-text

Implementing a tableview with multiple labels inside a cell

The tableview I am implementing is a kind of phonebook, where I have an entry(name) and below that I am displaying his/her phone numbers. These data make my cell.
An entry(name) can have multiple phone numbers(each phone number displayed in different lines). Against each phone number(in the same line) I have an option to set some status message. How can I implement this.
The way I have gone forward is:
I have created a 2 labels inside a cell. One for displaying the name and the other for displaying the numbers. These numbers are displayed in a multiline way. The problem I am facing is, adding the status message against each phone number(in the same row of each number). For that I may have to add the status as text in between the phone numbers(displayed in a multiline way) in the same label or I have to add another label inside this label. I am a bit confused regarding, how to go about this. Need help.
For multiple UILable in a cell, you can use custom cell.
What you are trying to implement is something like this or this. check it out.
Personnaly, I would add the "To" view as a subview of your UILabel and then set the toView.frame.origin.y to index * label.font.lineHeight.

How to insert and delete image and text in one view just like MMS apps on iPhone

I would like to implement something like MMS app on iPhone, where user will have an option to include an image and text.
The way I did is i created a UIUiew and included a UITextView and UIImageView inside it, and when user selects an image it goes in to the UIImageView and the user can type in the UITextView.
But the problem that I am facing is once you insert a UIImage how do you put a cursor after the image so that user can delete(backspace) the image and that space free's up and it becomes available for the user to type in more text.
Simple answer: You cannot mix text and images in a UITextView. If you want to achieve a behavior like this, you should look into using Core Text to render the text yourself (it supports other elements inside the text via certain callbacks through which you tell the text system how much space it is supposed to reserve for the image.
To make the text editable, you would have to implement the text editing protocols UITextInput and UIKeyInput. Which means you have to basically write your own text editor. It's possible but it's a lot of work.

How can I display structured text?

I have some text that I need to load from an XML file. The idea is to be able to make the text interactive. I should be able to tell when a user taps a piece of the text, like in the WordWeb app. I know this seems to be the kind of job that a UIWebView is for but I want to avoid generating HTML and implementing handlers for the hrefs. I hope that made any sense.
Another way could be using a UITableView with UITextViews or UILabels as content views for the cells. However, I couldn't find out how we can customize the appearance of the table view, add a border to the view for example.
The end result expected is a view that looks like a page from a book but pieces of the displayed text can be tapped and bookmarked etc.
Am I even thinking in the right direction?