Help on using codes just for html functions
Hi guys, I need to come up with an ebook type app. So i'm using the table view for different chapters. And each chapter, if using baker needs its own folder so that means e.g.; chapter 1 - 10 would need folder 'book01' to folder 'book10'. The reason is i just need the ability of baker to read from html files. Where in baker framework do i copy the function for the html rendering properly.
I tried to copy the content of .h and the .m files into my current project (of course with Baker copyrights comment}, but i am getting this error at:
// ****** GESTURES
- (void)userDidTap:(UITouch *)touch {
NSLog(@"User did single tap");
CGPoint tapPoint = [touch locationInView:self.view]; <-Property 'view' not found on object of type etc
NSLog(@" . 1 tap [%f, %f]", tapPoint.x, tapPoint.y);
// ...and swipe or scroll the page.
if (CGRectContainsPoint(upTapArea, tapPoint)) {
NSLog(@" /\\ TAP up!");
[self goUpInPage:@"1004" animating:YES];
} else if (CGRectContainsPoint(downTapArea, tapPoint)) {
NSLog(@" \\/ TAP down!");
[self goDownInPage:@"1004" animating:YES];
} else if (CGRectContainsPoint(leftTapArea, tapPoint) || CGRectContainsPoint(rightTapArea, tapPoint)) {
int page = 0;
if (CGRectContainsPoint(leftTapArea, tapPoint)) {
NSLog(@"<-- TAP left!");
page = currentPageNumber-1;
} else if (CGRectContainsPoint(rightTapArea, tapPoint)) {
NSLog(@"--> TAP right!");
page = currentPageNumber+1;
}
[self changePage:page];
} else if (touch.tapCount == 2) {
[self performSelector:@selector(toggleStatusBar) withObject:nil];
}
}
Let's see if I understand what you are trying to do: you want to use sections of code from Baker in your own application to manage navigation through a series of pages loaded from HTML files. Is that correct?
If it is, I'm afraid it's not going to be that easy: Baker's code is not modular enough, at this point, that you can just grab a function from it and reuse it.
I guess, in the case you're reporting, the function is expecting to be called inside a RootViewController, so it won't work if you call it from another class without making some changes.
PS: I edited your post to get the code to display properly ;)
In the case i posted above, is the changes substantial? Can you show me how to do it if i paste my current project codes here?
If you need to just read HTML files, you should read the UIWebView documentation from the iOS SDK. official Documentation.
If instead you need to incorporate the full Baker functionalities in your app that's going to be harder, but we can't help with that unfortunately, that's out of scope for us right now. In the future might be easier, that will be when the Issue #59 is going to be closed.
Alternative ways could be:
- use PhoneGap
- build everything as a single book inside Baker and fake the structure you need using JavaScript.