This app involves converting a book into an app. It has rich text (headings, bold, bullets, etc.) and instead of a page flip UI, it would be built in a split view controller. The master (left sidebar) would list chapters and bookmarks. The detail (right side) would have the chapter's contents and it would scroll down until the end of the chapter. Similar to Apple's Mail app on the iPad.
From my research, I can achieve the rich text by using HTML inside a UIWebView. What I'm not sure about is how to get bookmarks to work properly. Because there are no pages, the bookmark would need to be a vertical point in the chapter's content. For example, lets say the user reads half of Chapter 2, i.e. they have scrolled 50% of the way down. They could create a bookmark here.
My initial thoughts are to break the book's content up into "blocks", possibly paragraphs. For each chapter, in the detail view, use a UITableView. In each UITableViewCell, have a UIWebView with the HTML for each block. This way when the user creates a bookmark, we can store the cell's index path.
What would be the correct approach to this app?
I have created the same kind of e-book once, called Afili Lugat.
My approach was using javascript method:
element.scrollTop
to get the scrollbar position and keep that position under a SQLite database with a name for the bookmark. For this e-book I struggled with font size because it was changeable. When a user changes the font size the scroll position was not correct anymore as the page length increases/decreases. So I was keeping the font size in the SQLite database. So I was loading the page, changing the font size and scroll the page to offset value that I was getting from element.ScrollTop using window.scrollBy(0,<offsetvalue>);
Hope this helps.
Uygar
Related
I have to create a PDF which contains data like a quotation document (text, tables, images, etc.). The data varies from 1 page to 3-4 pages. A table cell may have combination of text and images. Also, I have custom graphics to be rendered in PDF to show different shapes.
Example format:
I have tried PDFKit provided by Apple. I was able to draw individual parts. But I don't know how can I achieve auto page break mode (which shifts data to new page when there is no more space available in a page). One way to achieve this is that I have to calculate individual heights and divide data into pages as per available page size.
Is there any better way to do it using PDFKit?
I am also aware about creating PDF using UIGraphicsBeginPDFContextToData(). It also doesn't support auto page break. We have to call UIGraphicsBeginPDFPageWithInfo() for each new page.
I have also tried TPPDF and SimplePDF. Both don't support either page break on table or custom views.
I also can't go for HTML to PDF solution as I have custom views to be drawn in PDF.
Which is the best way in iOS to create PDF with above mentioned requirements?
"One way to achieve this is that I have to calculate individual heights and divide data into pages as per available page size." - this is the only way as PDFKit does not include automatic data layout and auto page breaks.
First of all, let me tell you that I am new in Xamarin.
I am facing a problem in rendering controls dynamically on UI.
Approach I am using is: Xamarin.iOS
I have list of Questions having different Question Types
I loop through all questions and render them according to the question type.
Client wants to have HTML in Question Title, so that he can add any type of html tags including images, links etc in HTML. (I cannot use ‘NSAttributedString’ because it doesn’t support all HTML tags)
I am not using AutoLayout
I think UIStackView is a new control which is not available for older versions
Problem is, when I render UIWebView for QuestionTitle, and other control (let us say UITextField) for simple input from user, I do not know about the exact content length of Title (which is HTML) and therefore, I set default height of UIWebView as ‘100’ and once WebView is loaded, I set the height of webview according to the content size height. While rendering control, I calculate the Y-axis for every control to be rendered. When WebView is loaded, its height gets shrunk or expanded according to the size of content and therefore, the preceding sibling’s y-axis remains there since we don’t know how much siblings are there whose y-axis should be adjusted. (Keep in mind we have multiple webviews, as we have more than 1 question).
Is there any way, we can position all controls automatically (Just like we have LinearLayout in Android)?
Is there any better approach I can follow in order to resolve this kind of blocker?
I will really appreciate your help in this problem.
I'd like to create a layout to show this table in list view, the point is to make the text field resizable according to content. I have try several method, but all fails. I am using FileMaker 12.
Any help much appreciated.
For Browse mode you can set layout objects to dynamically resize based on the layout size, but not on the object contents. If you need this functionality in Browse mode you will probably need to use a web-viewer.
In Preview mode you can use sliding left and sliding up for reduction of the size of the layout objects, but there is no option to expand.
In Browse and Find modes, if a field isn't set to have a scroll bar, the field will expand while the user is entering data, but only then. It will return to the default size when the user navigates to another field or another record.
In Preview mode, you can make the field larger than it could possibly need and set it to slide up and also reduce the size of the enclosing part. But the user won't be able to interact with the interface of the layout (can't click buttons, change data, etc.).
A workaround might be to use a tooltip. If you set the tooltip to the contents of the field itself, then the user can hover over the field to see any expanded contents.
If you really need exactly the functionality that you mention (which I would define as having field height and enclosing body part expand in list view based on the field's content length while in FileMaker), the only way I could see doing it would be to use custom web publishing to create a web page and use FileMaker's web viewer to show that web page. F 'n' web has an article that might be of some assistance if you go this route.
I have an email client application, and I'm changing the way we show attachments for an email. Previously we had them up at the top of the email viewer in a scrollable list; now we're moving them so that they're displayed as a list at the bottom of the email content. For reasons related to the UIWebView control, it was necessary for me to implement these attachments as HTML code that is programmatically appended to the HTML of the original email (instead of doing them like a normal person would, where each attachment is just a UIView in iOS).
I'm now trying to configure accessibility for these HTML elements and running into some problems. Each "attachment" consists of a button-like background which is actually constructed from 3 images: one for the left side of the button, one for the right side of the button, and a middle portion which is stretchable (this allows the button to stretch in width without distorting the edges). There's also a paper clip image and a right-arrow image laid out on the "button", and two sub-DIVs for displaying the file name and its size.
The problem is that I want to make the outer DIV that encompasses all of these sub-elements to be the only thing that is focusable by Voiceover, and I want to be able to control what is announced by Voiceover for this DIV (so that I can include the file name, its size, whether or not it's currently downloading etc.). However, it seems that the only things Voiceover wants to focus are the three-subimages that make up the button background (and they're announced by their filenames) and the two sub-DIVs that show the filename and the file size. If I hide all of these sub-elements from Voiceover by setting aria-hidden="true", then nothing gets focused at all. If I set aria-hidden="false" on the outer DIV, the DIV is still not focused.
Is there any way to make a DIV focusable by Voiceover even when it doesn't contain any inner HTML content that Voiceover would focus on its own? I think I could hack a solution where I stretch a completely transparent PNG over the DIV and make that the only inner element with aria-hidden="false", but even then I'm not sure how to get Voiceover to read something other than the file's name.
Update: OK, it seems I can sort of achieve this by adding role="button" on my DIV while keeping all of the sub-elements aria-hidden="true". The entire DIV is now focusable, but it still announces itself as a "button" (I'd like it to say "attachment" instead as the type, but I can live with "button" if necessary). The main problem I'm now encountering is that Voiceover seems to ignore the aria-label property, and instead reads out any text that is contained in my sub-DIVs. Is there any way I can get Voiceover to read the aria-label property that I explicity set instead?
I have an app with a ListView showing a list of summary items.
I've added print support, but I'm stuck on splitting my content into different pages.
I can add multiple pages, but I don't know how to split my content into pages based on page size.
Currently I have a xaml user control for my print content with a bound ItemsControl in it. I'd either like to bind to a list of just the items that will fit on the page, or move the top visible item position up based on the page number.
I'm not sure which is the best approach and I'm not sure how to do either.
The only paging example I could find in the docs was for a rich text block, which relies on the RichTextBlockOverflow control. I don't think that will help me.