Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/117.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios 在html嵌入字符串中连接swift变量_Ios_Xcode_Uiwebview_Swift2_String Concatenation - Fatal编程技术网

Ios 在html嵌入字符串中连接swift变量

Ios 在html嵌入字符串中连接swift变量,ios,xcode,uiwebview,swift2,string-concatenation,Ios,Xcode,Uiwebview,Swift2,String Concatenation,标题不是很清楚我知道让我解释一下。我正在UIWebView上显示一些vimeo视频。现在,我正在使用这段代码使事情顺利进行: let embedHTML="<html><head><style type=\"text/css\">body {background-color: transparent;color: white;}</style></ head><body style=\"margin:0\">

标题不是很清楚我知道让我解释一下。我正在UIWebView上显示一些vimeo视频。现在,我正在使用这段代码使事情顺利进行:

    let embedHTML="<html><head><style type=\"text/css\">body {background-color: transparent;color: white;}</style></
    head><body style=\"margin:0\"><iframe src=\"//player.vimeo.com/video/171151492?autoplay=1&amp;loop=1\"
    width=\"266\"height=\"105\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";
而不是266和

self.webView.frame.height
而不是105

我该怎么做?我的意思是,我知道如何使用+连接字符串,但这是一种很难的方法,但它不起作用。有人有什么想法吗

let oneVar = self.webView.frame.width
let anotherVar = self.webView.frame.height
然后:

let embedHTML = "<html><head><style type=\"text/css\">body {background-color: transparent;color: white;}</style></
    head><body style=\"margin:0\"><iframe src=\"//player.vimeo.com/video/171151492?autoplay=1&amp;loop=1\"
    width=\"\(oneVar)\"height=\"\(anotherVar)\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";
let embeddehtml=“body{background color:transparent;color:white;}”;

随时可以。快乐编码:)
let embedHTML = "<html><head><style type=\"text/css\">body {background-color: transparent;color: white;}</style></
    head><body style=\"margin:0\"><iframe src=\"//player.vimeo.com/video/171151492?autoplay=1&amp;loop=1\"
    width=\"\(oneVar)\"height=\"\(anotherVar)\" frameborder=\"0\" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>";