Load Japanese Text into UIWebView - iphone

I'm making an app for read epub book with Japanese language. In general, web view will load text from html and display in web view from left to right and from top to bottom, but my app requires display text in web view follow text from top to bottom and then from left to right, so is there any solution for displaying text in UIWebView follow above format, thanks for your helps...

You're looking for the CSS property writing-mode: vertical-rl.
However, this is a broad topic. You'll probably need to tweak other properties such as text-orientation (to position non-CJK glyphs upright when necessary), text-combine (to group two numbers horizontally in a single character "cell", and so on.
In any case, beware, you are now in an alternate universe with basic concepts like "left" now changing their meaning on you.

Related

How to highlight text in epub like ibooks app

I need to highlight text in epub book,when user selects the text,i can get the text,what the user has selected,but i need to highlight,the text permanently what user selected,thanks,any help will ne appreciated.
There's nothing built in to iOS that will do this. Some broad techniques that might work:
If you're showing the book in a web view, you might be able to wrap that area in a span and style it to create a highlight.
If you're using Core Text, you could draw the highlight in directly, either before or after drawing the text. (Your choice will decide how the highlight affects non-black text.)
You could add a transparent view over the text that draws in the highlight.
As for adding highlight-related items to the selection menu, see this Stack Overflow post. You probably won't be able to get icons in the menu like Apple does, though; that seems to be a private API. You could probably override the whole menu system if you want something closer to Apple's look, but that'll be quite a bit of work.

How to deal with over-long navigation bar titles?

In my iPhone app, my navigation bar titles were often too long for the page, causing them to truncate (I usually have a button either side of the title, so space is limited). I therefore created my own title labels with a hard-coded font size so the text would shrink accordingly. However, I now realise that this wont neccesarily look right when other languages are chosen.
What is the normal practice for this? Do people just accept a truncated title, or reduce the font size accordingly (for English), or enforce a very short title that will be short enough in all languages?
I don't think there's a magic solution here. You just need to pick shorter titles or accept the truncation. You can always put the full text in the display rather than in the title bar if necessary.
Based on feedback from some users, I wouldn't go down the route of using smaller text. (I'm basing this on a toolbar at the bottom of the screen rather than the title bar, but the same principle applies.)
I chose one title that is short enough for every language and display it regardless of what the view controller shows.
Apple shows as a title what the view controller shows: in the iPod app, for instance, when you select a playlist, the whole name is displayed. If it is too long, it gets truncated.
So I think it is ok to show a truncated title. You should not however make the text smaller as it will get too hard to read.
Thought it would be relevant to contribute to this discussion with a great solutoin that I came across in one of the apps I've been using.
https://itunes.apple.com/in/app/bookmyshow-movie-event-play/id405894842?mt=8
These guys animate the title left and right within the titleview's bounds, if the title text is too long. Looks neat and elegant without truncation, smaller text or other hassles.

Cocoa Touch text view with aligned, justified text

I am trying to create a textview with predefined height that will contain justified text.
When entering the text into the view, I need to be able to check when the view is full.
How would I do this? Core Text?
I am using sdk-3.2.
You cannot do it using UITextView (that would be the most "logical" way to do it), or any others SDK current classes.
The only simple way to do it if to put the content to be justified in an html file, justify it using CSS, and show it in a UIWebView.

Large scrollview table with buttons

We are trying to write a training manual application for the iPhone. On the top half of the screen is a diagram of a car engine, on the bottom half is some text. At the user repeatedly hits a "next" button, we highlight different parts of the engine, and in concert we highlight different parts of the descriptive text below.
We basically want "living text" in the text half, with the illustration following along on top to where the reader is in the text. What we'd like from the text is 1. user can scroll it using their thumb so possibly a UIScrollView 2. the software can explicitly drive a scroll to any part of the text (when they hit the "next" button). 3. the words in the text are interspersed with hotlinks e.g. "this is the camshaft... this is the piston..." and the user should be able to click on any of the keywords like camshaft, piston, and have the diagram highlight that. (The problem is not highlighting the diagram, its capturing the click). The text would have 300~400 buttons/links/keywords and about 600 words of text.
Since this is fairly similar to using a web browser, we tried using Apple's version of webkit using a UIWebView and handleOpenURL to register a service back to the app itself. But Webkit for internal links a popup comes up asking permission to access that link. Every single the user wants to go to a link (in our case just an internal event that we'd intercept so that we can highlight e.g. the camshaft). Tried to intercept the event from the HTML view, but that didn't work.
It seems like the best we can do is to abandon scrolling text, and make the text part more like flash cards or a power point presentation, breaking the text into custom UIViewCells with buttons inside a UIScrollView. However, this would impose an annoying constraint on the author that they would have to write everything to fit in the UIViewCells, sort of chunky.
Any ideas would be appreciated.
This is definitely something you can use a UIWebView for. Don't use handleOpenURL, rather, set your viewController as the webview's delegate, and override -webView:shouldStartLoadWithRequest:navigationType:. When this gets called, check the request, and pull out your link data from there.
It would probably be easier to implement that completely in JavaScript in the document you load in a UIWebView. You would have to use JavaScript (i.e. [UIWebView stringbyevaluatingjavascriptfromstring:]) anyway to achieve things like scrolling to a certain position.

iPhone custom UITableViewCell accessory graphic, a HIG violation?

I want to introduce a custom pencil accessory image in a tabel cell and in the standard accessory righthand UITableViewCell position. The pencil image will be used to indicate that the text in the table cell can be edited via a popup modal full screen view.
Will Apple penalize this innovation during the app review process?
My justification is that the standard disclosure indicators do not convey the right meaning. According to the Apple HIG doc the ">" disclosure should present another more detailed list view and the the blue "+" disclosure button should reveal extra details about the selected table row.
I feel that opening a text edit view falls between the ">" and "+" usage, hence my pencil image idea.
Edit: Just to complete the picture, the table view has two fat rows. The upper row poses a multiline question and the lower row shows a text answer.
I don't think that Apple would penalize you for creating a custom button/icon. This is not something to concern. The problem here is to make you user understand what is the function of you custom icon, since they are used with the standard iPhone UI.
I my opinion for the functionality that you want to put on your icon, it would be better if you use the custom UI for editing table cell, that is presented on this image that I could find Googling (http://adeem.me/blog/wp-content/uploads/2009/UITableView/AddDeleteReorderUITableView/Picture%202.png).
So, people are used to edit the content of table cells by using the edit button and after pick the current cell...than you can show the modal view, so the user can edit the content.
To have a better picture, compare your table cell with, for example, the Clock app.
Try to avoid custom controls as much as you can. if something exists on the standard UI, go for it it is easy for people to look and understand.
Imagine that in your browser the load icon, instead of this circular arrow, it was changed by "L" in the latest update, would be something tricky to us to understand a non-standard symbol.
Think about it and chose the most appropriated approach for your purpose.
Cheers,
VFN