In iOS5 i want to load Youtube movies, and i done it with:
- (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];
videoView = [[UIWebView alloc] initWithFrame:frame];
[videoView loadHTMLString:html baseURL:nil];
[self.view addSubview:videoView];
}
calling by:
[self embedYouTube:@"http://www.youtube.com/v/PqtUSSdf8b4" frame:CGRectMake(0, 0, self.view.frame.size.width, 100)];
And i have standard Youtube frame with "done" button. When i hit done button i'm redirect to my root VC. why? how can i get to my VC (the one when i'm calling it) ?
And more important - how to catch "done button" event ?
EDIT:
I have MainVC and DetailVC. MainVC calls DetailVC as a ModalViewController
. From there I call this embedYouTube
method. When i'm hitting done on this screen:
i'm returning to MainVC not DetailVC. Why? How to catch this event?
EDIT: And iOS 6 displays only black background - nothing. Why?