- (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;
}
此代码无效,我在第UIButton *b = [self findButtonInView:YouTubePlayer];
行收到2条警告警告:
'YouTubePlayer'的本地声明隐藏了实例变量 'SecondViewController'可能无法响应'-findButtonInView:'
答案 0 :(得分:0)
[YouTubePlayer view]
。- (UIButton *)findButtonInView:(UIView *)view;
行。