Reputation: 75
I have this small code:
NSString *size = [LabelNewContent stringByEvaluatingJavaScriptFromString:@"return Math.max(
document.body.scrollHeight, document.documentElement.scrollHeight,
document.body.offsetHeight, document.documentElement.offsetHeight,
document.body.clientHeight, document.documentElement.clientHeight
);"];
the problem is xcode doesnt recognize the parentheses and commas as a whole string.
Upvotes: 0
Views: 306
Reputation: 250
Replace you code by
NSString *size = [LabelNewContent stringByEvaluatingJavaScriptFromString:@"return %f",Math.max(
document.body.scrollHeight, document.documentElement.scrollHeight,
document.body.offsetHeight, document.documentElement.offsetHeight,
document.body.clientHeight, document.documentElement.clientHeight
)];
hope it will help you.
Upvotes: -2
Reputation: 8800
NSString *size = [LabelNewContent stringByEvaluatingJavaScriptFromString:@"return Math.max/(document.body.scrollHeight, document.documentElement.scrollHeight,document.body.offsetHeight, document.documentElement.offsetHeight, document.body.clientHeight, document.documentElement.clientHeight);"];
try above thing
Upvotes: 0
Reputation: 40018
Use \
to make it multi line string
NSString *size = [LabelNewContent stringByEvaluatingJavaScriptFromString:@"return Math.max(\
document.body.scrollHeight, document.documentElement.scrollHeight,\
document.body.offsetHeight, document.documentElement.offsetHeight,\
document.body.clientHeight, document.documentElement.clientHeight\
);"];
Upvotes: 8