相关疑难解决方法(0)

iOS 8 youtube视频嵌入

我面临的问题似乎无法理解.

我有这个代码在iOS 7的Xcode 5中完美运行:

- (void)viewDidLoad {
  [super viewDidLoad];
  // Do any additional setup after loading the view, typically from a nib.
  CGFloat width = self.view.frame.size.width;
  CGFloat height = self.view.frame.size.height;
  UIWebView *webview = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, width, height)];
  NSString* embedHTML = @"\
  <html><head><meta name=\"viewport\" content=\"width=device-width; initial-scale=1.0; user-scalable=0;\"/>\
  <style type=\"text/css\">\
    body {\
    background-color: transparent;\
   color: black;\
  }\
  </style>\
  </head><body style=\"margin:0;\">\
  <embed id=\"yt\" src=\"https://www.youtube.com/v/M7lc1UVf-VE?hd=1\" type=\"application/x-shockwave-flash\" \
  width=\"%0.0f\" height=\"%0.0f\"></embed>\
  </body></html>";
  NSString *html = [NSString stringWithFormat:embedHTML, width, height];
  [webview loadHTMLString:html baseURL:nil];
  [self.view addSubview:webview]; …
Run Code Online (Sandbox Code Playgroud)

youtube xcode uiwebview ios

10
推荐指数
1
解决办法
4002
查看次数

标签 统计

ios ×1

uiwebview ×1

xcode ×1

youtube ×1