我的应用程序中有一个脚本,在UIView的一部分中加载Youtube链接,链接由我的服务器(mySQL /使用php)提供,并且从中加载...下面这个脚本工作正常....但是......
这就是我现在所拥有的,我正在寻找以编程方式删除部分(它给出维度并可能用UIWebView替换它),因此我可以即兴使用IB,这将有助于我的应用程序启动时,快速动画发生,然后我想在viewDidLoad完成后加载和显示此youtube链接.
.h文件:
- (void)embedYouTube:(NSString *)urlString frame:(CGRect)frame;
Run Code Online (Sandbox Code Playgroud)
.m文件
//view did load function...
[self embedYouTube:youtubestring frame:CGRectMake(69,72,184,138)];
//after the view did load is closed I have..
- (void)embedYouTube:(NSString *)urlString frame:(CGRect)frame {
NSString *embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: transparent;\
color: white;\
}\
</style>\
</head><body style=\"margin:0\">\
<embed id=\"yt\" src=\"%@\" type=\"application/x-shockwave-flash\" \
width=\"%0.0f\" height=\"%0.0f\"></embed>\
</body></html>";
NSString *html = [NSString stringWithFormat:embedHTML, urlString, frame.size.width, frame.size.height];
UIWebView *videoView = [[UIWebView alloc] initWithFrame:frame];
[videoView loadHTMLString:html baseURL:nil];
[self.view addSubview:videoView];
[videoView release];
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将非常感谢!! 谢谢