Reputation: 2405
I am creating HTML using following code :
NSString *string = [NSString stringWithFormat:
@"<html> \n" "<head> \n"
"<style type=\"/css\"> \n"
"body {font-family: \"%@\"; font-size: %@;}\n"
"</style> \n"
"</head> \n"
"<body>%@</body> \n"
"</html>",@"Helvetica",[NSNumber numberWithInt:17],
@"<p><i>My data</p>"];
Here I am giving [NSNumber numberWithInt:17]
for font size but any change in this 17
dosen't making changes in font size of HTML.
What should I do ?
Upvotes: 1
Views: 2226
Reputation: 44633
I think your problem was that you had the wrong style type – /css
and not text/css
.
"<style type=\"text/css\"> \n"
Upvotes: 3
Reputation: 51374
Passing [NSNumber numberWithInt:17];
doesn't passes the actual value, it just passes the object reference. So, you should be passing it like this,
font-size: %dpx;
And the value as just,
17
Upvotes: 2
Reputation: 5104
You need a unit attached to it. the CSS font-size property needs to be
font-size: 17px
or you could also use em or percentages
Upvotes: 4