在网页中实现网络视图时,我的代码如下所示
_testURLString = @"http://192.168.4.196/course/Course";
NSString *embedHTML = [NSString stringWithFormat:@"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: blue;\
}\
</style>\
</head><body style=\"margin:0\">\
<embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
width=\"400\" height=\"700\"></embed>\
</body></html>"];
NSString *html = [NSString stringWithFormat:embedHTML, _testURLString, 400, 700];
UIWebView *videoView = [[UIWebView alloc] initWithFrame:frame];
videoView.backgroundColor = [UIColor clearColor];
[videoView loadHTMLString:html baseURL:nil];
[self.view addSubview:videoView];
通过X代码进行警告比在处的数据参数警告更多的是'%'转换。
src = \“%@ \”
我不知道该怎么办,请帮助我。
您正在使用stringWithFormat:
,并且该方法应该替换src=\"%@\"
为另一个字符串,但是您没有传递任何内容。
应该是这样的:
NSString *embedHTML = [NSString stringWithFormat:@"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: blue;\
}\
</style>\
</head><body style=\"margin:0\">\
<embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
width=\"400\" height=\"700\"></embed>\
</body></html>", _testURLString]; //or something else
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句