Iphone 自动播放youtube错误?
此代码不起作用,我在Iphone 自动播放youtube错误?,iphone,objective-c,youtube,Iphone,Objective C,Youtube,此代码不起作用,我在UIButton*b=[self-findButtonInView:YouTubePlayer]行上收到2条警告警告是: “youtubeplyer”的本地声明隐藏实例变量 “SecondViewController”可能不响应“-findButtonInView:” 您应该在findButtonInView方法中调用[YouTubePlayer view] 在SecondViewController.h文件中,添加行-(UIButton*)findButtonInView:
UIButton*b=[self-findButtonInView:YouTubePlayer]行上收到2条警告代码>警告是:
“youtubeplyer”的本地声明隐藏实例变量
“SecondViewController”可能不响应“-findButtonInView:”
您应该在findButtonInView方法中调用[YouTubePlayer view]
在SecondViewController.h文件中,添加行-(UIButton*)findButtonInView:(UIView*)视图代码>
这是怎么回事:-(UIButton*)findButtonInView:(UIView*)视图{UIButton*按钮=nil;[YouTubePlayer视图];if([view isMemberOfClass:[UIButton class]]){return(UIButton*)视图;}if(view.subviews&&[view.subviews count]>0){for(UIView*视图中的子视图.子视图){button=[self-findButtonInView:subview];if(button)return button;}}}}return button;}哇。你能用它更新你的问题吗,这会让它更容易阅读。。
- (void)webViewDidFinishLoad:(UIWebView *)YouTubePlayer {
UIButton *b = [self findButtonInView:YouTubePlayer];
[b sendActionsForControlEvents:UIControlEventTouchUpInside];
}
- (UIButton *)findButtonInView:(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 findButtonInView:subview];
if (button) return button;
}
}
return button;
}