- (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 (UIBut开发者_开发技巧ton *)view;
}
if (view.subviews && [view.subviews count] > 0) {
for (UIView *subview in view.subviews) {
button = [self findButtonInView:subview];
if (button) return button;
}
}
return button;
}
This code is not working, i am getting 2 warnings on the line UIButton *b = [self findButtonInView:YouTubePlayer];
the warnings are :
Local declaration of 'YouTubePlayer' hides instance variable 'SecondViewController' may not respond to '-findButtonInView:'
- You should call
[YouTubePlayer view]
in the findButtonInView-method. - In your SecondViewController.h-file, add the line
- (UIButton *)findButtonInView:(UIView *)view;
.
精彩评论