0
它的第一次,我用的UIWebView並在第一時間,我在iPhone上使用的視頻。 視頻播放,但是:將UIWebView中的Youtube嵌入到透明img後面。的wmode透明的z-index不起作用
我想有一個老校電視(圓角)與前景開關等。電視機是在中間透明像素的圖像,從而使位於所述電視後面的視頻會發光通過好像視頻將在電視上顯示。
但首先所有的視頻都有,我不能刪除邊框和第二它總是在前臺。在Safari和Mac上的Firefox中它工作正常。那麼這是iPhone的事情,難道它不能在iPhone上工作嗎?或者我有一些CSS/HTML錯別字?
我使用這個代碼:
- (void)embedYouTube:(NSString *)urlString frame:(CGRect)frame {
NSString *embedHTML = @"\
<html><head>\
<style type=\"text/css\">\
body {\
background-color: black;\
}\
#container{\
position: relative;\
z-index:1;\
}\
#video,#videoc{\
position:absolute;\
z-index: 1;\
border: none;\
}\
#tv{\
background: transparent url(tv.png) no-repeat;\
width: 320px;\
height: 205px;\
position: absolute;\
top: 0;\
z-index: 999;\
}\
</style>\
</head><body style=\"margin:0\">\
<div id=\"tv\"></div>\
<object id=\"videoc\" width=\"240\" height=\"160\">\
<param name=\"movie\" value=\"%@\"></param>\
<param name=\"wmode\" value=\"transparent\"></param>\
<embed wmode=\"transparent\" id=\"video\" src=\"%@\" type=\"application/x-shockwave-flash\" \
width=\"240\" height=\"160\"></embed>\
</object>\
</body></html>";
NSString *path = [[NSBundle mainBundle] bundlePath];
NSURL *baseURL = [NSURL fileURLWithPath:path];
NSString *html = [NSString stringWithFormat:embedHTML, urlString,urlString];
UIWebView *videoView = [[UIWebView alloc] initWithFrame:frame];
[videoView loadHTMLString:html baseURL:baseURL];
[self.view addSubview:videoView];
[videoView release];
}
嗯,我現在在一個UIImageView添加在電視上的UIWebView的頂部,它的工作並沒有那麼大黑客攻擊的,所以我會去用它,但也許有人可以回答這個問題? – Allisone 2010-06-10 11:39:15