2011-02-11 5 views
0
I have done the followings in objective c and javascript, 

    1. extract the epub file using unzip library. 
    2. parse the .opf file to get the .xhtml files . 
    3. Using navigation tab i have display the contents like plain text . 
    4. Each page javascript to display contents in page by page to the html. 
    5. i finished the page flip also works fine. 

I have to implement the followings, 

    1.Apply CSS to the html contents like iBooks 

表示されたコンテンツにCSSを適用する方法は誰も知りません。私は今まで1週間にしようとしています。私は 解決策を得ませんでした。xcodeのiphoneとipad epubリーダー

に関して
Thanks in Advance, 

、 Suresh.M

+0

この解決策を見つけたことはありますか? – Matjan

答えて

1

あなたはこのような何かを試みることができる:

NSString *varMySheet = @"var mySheet = document.styleSheets[0];"; 

NSString *addCSSRule = @"function addCSSRule(selector, newRule) {" 
"if (mySheet.addRule) {" 
    "mySheet.addRule(selector, newRule);"        // For Internet Explorer 
"} else {" 
    "ruleIndex = mySheet.cssRules.length;" 
    "mySheet.insertRule(selector + '{' + newRule + ';}', ruleIndex);" // For Firefox, Chrome, etc. 
"}" 
"}"; 

    // NSLog(@"w:%f h:%f", webView.bounds.size.width, webView.bounds.size.height); 

NSString *insertRule1 = [NSString stringWithFormat:@"addCSSRule('html', 'padding: 0px; height: %fpx; -webkit-column-gap: 0px; -webkit-column-width: %fpx;')", webView.frame.size.height, webView.frame.size.width]; 
NSString *insertRule2 = [NSString stringWithFormat:@"addCSSRule('p', 'text-align: justify;')"]; 
NSString *setTextSizeRule = [NSString stringWithFormat:@"addCSSRule('body', '-webkit-text-size-adjust: %d%%;')",fontPercentSize]; 

私はフェデリコFrappiで... AePubReaderから

乾杯をそのコードを入手します!

関連する問題