I’m working on an app. that uses the pageFlip module on GitHub (https://github.com/appcelerator/titanium_modules/tree/master/pageflip/mobile/ios) - very cool module. I’m NOT using a .pdf, but am following the example laid out in views.js (snippet below).
I’m using this to help publish a couple of short stories. I’m struggling a bit, however, when determining how much to push to a given page. My current thought is that the story itself would simply be TEXT column in the books db, that I read and push to pages. The book table, for example, would simply contain bookId, title, story, etc. I don’t want to ‘hard code’ pages in the db, given that the page size (amount of text) that would fit on a page would vary by device.
Is there something simple I am missing, or do I need to parse the Story data, such that I can create and push the appropriate amount of content to the textArea per page? If so, any suggestions on how best to dynamically parse the data from the Story column (e.g. n words per page)
function createPage(number) { var pageView = Titanium.UI.createView({ }); var story = Titanium.UI.createTextArea({ editable : false, focusable : false, textAlign : 'right', scrollable : true, value : 'An Error Has Occured, please close book and try to re-open', font : { fontSize : 32, fontFamily : 'Marker Felt', fontWeight : 'bold' }, color : 'black', backgroundColor : 'transparent', textAlign : 'left', top : 270, bottom : 80, width : Titanium.Platform.displayCaps.platformWidth * .95, height : Ti.UI.FILL }); var pageNumberView = Titanium.UI.createView({ //backgroundColor : 'green', bottom : 0, height : '65', //width : Ti.UI.FILL, }); var pageNumberLabel = Titanium.UI.createLabel({ color : 'black', text : 'Page ' + number + ' of ' + bookPages, textAlign : 'center', buttom : 100, //backgroundColor : 'yellow', left : 30, right : 30, width : Titanium.UI.FILL, height : 45 }); story.value = need to put enough for one page worth of text!; Ti.API.info("story = " + story.value); pageNumberView.add(pageNumberLabel); pageView.add(pageNumberView); pageView.add(story); //selectedPages.next(); return pageView; };