Is UITextView enough for a simple writing app? - iphone

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 Protocol in order to build a text editor from scratch.
Do you think UITextView is enough to make a simple writing program?
Do most writing apps in AppStore use their own framework using UITextInput?
Thank you!

UITextView is the ideal view to display and edit multiple lines of text. You can format the text using font, size and color. The only formatting restriction is that you can have only one text format for the whole view. The Notes app written by Apple is a typically use of UITextView.
Check Apple documentation for more...
Cheers

Related

Display Rich Text Content as UIWebView or UILabel+CoreText

I'd like to display rich text content in my app. I want user to create simple WYSIWYG input with support of bold, italics, shadow, outline, image HTML-like tags. I am puzzled if I should go with UIWebView or custom written UILabel/UIView which can have CoreText framework added to support all those above stated properties. I see there are libraries which are using both approaches.
Does anyone have an experience dealing with these approaches who can suggest cons and pros? Thanks
The web view approach has quite an overhead and likely a delay to display the rendered text. I would recommend using DTCoreText.

iphone: How do I make one scrollable field which contains multiple fonts and images?

I need to create one scrollable field which contains multiple fonts and images. Is that possible? I was thinking of using UITextView for this field, but I doubt that it can do what I need it to do.
If this field is not in a UITableView, then the easiest solution would be to organize your content in a html document then present it in a UIWebView which will work on both iOS5 and iOS6. Fonts can be handled through webfonts and styled via. css. Otherwise, you'll have some work to do.
You can learn about webfonts here:
https://developers.google.com/webfonts/docs/getting_started
For rich text in a UITextField ...
Well, there's good news and bad news. The good news is that it's pretty easy to do on iOS6. It's just a matter of creating an NSAttributedString and passing the string into a UITextView. The text should be formatted as you describe in an NSAttrbutedString.
If you haven't used an NSAttributedString, you can start learning about them over here:
How do you use NSAttributedString?
If you have an Apple developer account, check out the WWDC 2012 video: Introduction to Attributed Strings for iOS
https://developer.apple.com/videos/wwdc/2012/
Now the bad news ... this is not included in iOS5. So you have to a) build your own custom view using something like CoreText to render the text, b) punt and use a UIWebView (a terrible idea in a table view), or c) you can check out some of other home grown solutions such as these:
https://github.com/AliSoftware/OHAttributedLabel
https://github.com/enormego/EGOTextView#readme
There are more but you'll have to kick around google to find them.
As for images, it's just a matter of organizing the imageviews alongside the text views. Make sure to put all the content in a UIScrollView and you should be on your way.
Good luck!

How to keep 2 different fonts within the same UITextField or UITextView?

I want to set 2 different fonts within the same UITextField and UITextView . How to do it?
Its a bit of work - you'll need to use Core Text and NSAttributedString to do this.
There are plenty of tutorials and examples, although I'd suggest using someone else's already-made UILabel subclass such as:
OHAttributedLabel
or
TTAttributedLabel
As these usually have some convenience methods to make handling a lot easier.
I would do it with 2 custom textfields overlaying, both backgroundcolor:clearColor, maybe stuffed on an image that represents the background.
I don't think it is possible to handle 2 different fonts within the same UITextField or UITextView. If you want to have different font style you can either set different font style within a UIWebView or use the coreText API.
Here are some links that might help:
iPhone Development - Setting UIWebView font
the official doc on core text: https://developer.apple.com/library/mac/#documentation/StringsTextFonts/Conceptual/CoreText_Programming/Introduction/Introduction.html
I know you already picked a valid answer but... don't do it that way... it's not worth it. Use a webview instead and draw everything with html.
In interface builder change Text View's Text field to Attributed. In that small editor that appears you can change the font/format/color of the selected text, like in any advanced text editor.

How to allow text highlighting in an iPad app?

I'm making an iPad magazine app where the user will be able to highlight any amount of the text. These highlights will need to be saved and appear everytime that article is loaded.
Can I do this somehow with CoreText (which is currently what I am using to allow multi-columned formatting)?
I have noticed that selecting text using HTML in a UIWebView doesn't work properly if there are images within the text.
Anyone have any advice?
Thanks a lot,
-Chris
There's no built in support in CoreText for selection or "Copy & Paste", but you can make your own selection engine using some CoreText functions.
Take a look at this other topic post.
Core Text - select text in iPhone?

Should I use UIWebView or UITextView to display text in an e-book reader app?

I want to make an e-book reader iPhone app. Should I use UITextView or UIWebView to display the text? Which control is used by other e-book readers?
I would use a UIWebView, as it gives you much more flexibility in the presentation of the text. According to the UITextView Class Reference:
This class does not support multiple
styles for text. The font, color, and
text alignment attributes you specify
always apply to the entire contents of
the text view. To display more complex
styling in your application, you need
to use a UIWebView object and render
your content using HTML.
Also, UITextView uses scrolling to display large amounts of text (it inherits from UIScrollView); in an e-book reader, you will most likely want to paginate the content, so you will not want the scrolling behaviour.
UIWebView is much better solution than UITextView mainly due to support of rich formatting of its contents. On the other hand you will miss some very important functions which you get for free while using UITextView. I'm talking mostly about searching inside, changing contents size etc. All of this is possible with UIWebView but it's not straightforward - css & javascript are for the help here
Did you get highlight functionality for this as font size can change. Save them for future so that when ever he came to same page can see them
U should use UIWEB view ,as to provide paragraph and other functions of text are not supported by text view, u can directly implement html code and can make the app with proper view of text. So my suggestion is to use web view.