I need to show some data in a textview coming from coredata (like this for example),

I imagine a possible solution (dont know if is the right one or how to do it, please advice),
so bring the data from coredata to a string, appending all the data neeeded in the string with the equivalent of “\n” for new line where needed; then show the data in the text view,
(please refer to example image to know what is needed)
- so how to bring the data from coredata to this textView with this formatting?
- please note I only want to know if this is a proper way to do it (imagined solution? or if there is a more proper way?)
Thanks a lot!!
I tackled an identical issue in one of my apps.
The approach I took was to first structure my core data model so that the pieces of data had enough granularity so that I could construct different views as required. In other words, instead of one property for “name”, I have three properties. One for “first name”, one for “middle name”, and a third for “last name”. I also created a separate “data layer” object so that I could easily get to pieces of my data from anywhere in the app.
Next, to construct my view that shows data in a sort of form view. Using Interface Builder, I simply laid out a view using primarily UILabel view objects as placeholders. Then, as the user switches between person views, I call on the data layer object for pieces of data and just “fill in” in the UILabel placeholders.
I also render a PDF file in paragraph form. Similar to what you are doing. For that, I use an NSMutableString along with the NSString stringWithFormat convenience method. Using NSMutableString, you can concatenate strings with newline characters embedded as needed. For this, I also call on my data layer object for the pieces of data.
Hope this helps. Good Luck.