Opening a epub file on a UIWebView
Xcode Open File (epub) with xcode programming - NOT OPENING (O just see a little white block on upper right)
I have also added epub file in project, I am using following below code to open it in viewdidload method.
- (void)viewDidLoad
{
NSString *filepath = [[NSBundle mainBundle]pathForResource:@"MyEpub" ofType:@"epub"];
UIWebView *wv = [[UIWebView alloc]initWithFrame:CGRectMake(0, 0, 100, 100)];
[self.view addSubview:wv]开发者_StackOverflow中文版;
[wv loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:filepath]]];
[super viewDidLoad];
}
Well, you won't be able to open an ePub file in a UIWebView
, because it's not a supported format.
Apple provide a list of supported formats here:
http://developer.apple.com/library/ios/#qa/qa1630/_index.html
You'll need to use the link Jano provided above to decompress, parse, and open up the file.
精彩评论