i want to know if it is possible to launch the youtube video without launching the 开发者_开发问答default small photo icon. I just need a regular icon which is able to be launched to play a youtube video. Unfortunately, as the Youtube official suggestion suggests, there is currently no way to fulfill my request. Does any body concern this issue and already figure this out?
http://apiblog.youtube.com/2009/02/youtube-apis-iphone-cool-mobile-apps.html
if I understood your question correctly:
- embed youtube player in a UIWebview and set the webview to hidden
in your customized button method do the following:
a- search for UIButton in the webview subviews :
-(UIButton*)getButtonInView:(UIView*)view{
UIButton *button = nil;
if([view isMemberOfClass:[UIButton class]]){
return (UIButton*) view;
}
if(view.subviews && [view.subviews count] > 0) {
for(UIView *subview in view.subviews) {
button=[self getButtonInView:subview];
if(button) return button;
}
}
return button;
}
b- send action to the fetched button:
[button sendActionsForControlEvents:UIControlEventTouchUpInside];
hope that will help
----NOTE----
As mentioned by lxt. Please note that that this solution relies on Youtube plugin implementation not changing otherwise it might break in the future.
精彩评论