2

Title is not very clear i know let me explain. I am displaying some vimeo videos on an UIWebView. Now i am using this bit of code to make things work:

    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>";

Now where it says: width=\"266\"height=\"105\" i want to put in:

self.webView.frame.width

instead of 266 and

self.webView.frame.height

instead of 105

HOW can i do this? I mean i know how to concatenate strings using + but this was way to hard it did not work. Anybody got any ideas?

1 Answer 1

2
let oneVar = self.webView.frame.width
let anotherVar = self.webView.frame.height

And then:

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>";
Sign up to request clarification or add additional context in comments.

1 Comment

Anytime. Happy coding :)

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.