0

In my application I am loading HTML String which is parsed from the xml file I need to change the color, name and size of the font. To replace that I have already use the followings code but its not working

NSString *webString = [[NSString alloc] initWithFormat:@"document.getElementsByTagName('body')[0].style.webkitTextSizeAdjust= '%d%%'", 
                      textFontSize];
    [web stringByEvaluatingJavaScriptFromString:webString];

Is there any way then please suggest me the answer.

Thanks in Advanced!!!

1 Answer 1

1

Use NSAttributedString instead. Here's the docs from Apple. You can set the font type, colour, and size. You can then convert NSAttributedString back to HTML this way.

It's only available on iOS 6 and above.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks Enrico Susatyo. I want to change everything using javascript.. is that possible other than solution
@kagmanoj the other answer is actually a lot better than mine. Try that one.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.