views:

15

answers:

1
    - (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;
}

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:'

A: 
  1. You should call [YouTubePlayer view] in the findButtonInView-method.
  2. In your SecondViewController.h-file, add the line - (UIButton *)findButtonInView:(UIView *)view;.
Emil
How is this: - (UIButton *)findButtonInView:(UIView *)view { UIButton *button = nil; [YouTubePlayer view]; if ([view isMemberOfClass:[UIButton class]]) { return (UIButton *)view; } if (view.subviews if (button) return button; } } return button;}
Wow. Could you update your question with that, it'll make it alot easier to read..
Emil