Problem in calling a function from different class using protocols-iphone
<p>I use cocos2d for my game. In which I play a movie and have a separate overlay view for controls.The touches are detected in the overlay view. Now when the touches are detected the function in the game code has to be invoked. But the function is not detected and there is no error. I dont know what has gone wrong. Someone please help me.
The code are as follows</p>

<p>The protocol part is </p>

<pre><code>@protocol Protocol
@required
- (void)transition1:(id)sender;
@end
</code></pre>

<p>The function which is to be invoked in the game code is </p>

<pre><code>- (void)transition1:(id)sender
{
    [[Director sharedDirector] replaceScene: [ [Scene node] addChild: [Layer4 node] z:0] ];
}
</code></pre>

<p>The code in the overlay view in MovieOverlayViewController.h</p>

<pre><code>#import "Protocol.h"

@interface MovieOverlayViewController : UIViewController
{
    UIImageView *overlay;
    NSObject &lt;Protocol&gt; *transfer;
}
@end
</code></pre>

<p>The code in the overlay view in MovieOverlayViewController.m</p>

<pre><code>@implementation MovieOverlayViewController

- (id)init
{
    if ((self = [super init]))
        self.view = [[[UIView alloc] initWithFrame:[[UIScreen mainScreen] applicationFrame]] autorelease];
    return self;
}

-(void) viewWillAppear:(BOOL)animated
{
    overlay = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"overlay.png"]] autorelease];

    [self.view addSubview:overlay]; 
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event 
{     
    UITouch *touch = [touches anyObject];
    CGPoint point = [touch locationInView:self.view]; 
    NSLog(@"pointx: %f pointy:%f", point.x, point.y);

    if (CGRectContainsPoint(CGRectMake(1, 440, 106, 40), point))
    {
        // the function is called here
        [transfer transition1: nil];
    }
    else if (CGRectContainsPoint(CGRectMake(107, 440, 106, 40), point))
        NSLog(@"tab 2 touched");
}

- (void)dealloc
{
    [overlay release];
    [super dealloc];
}

@end
</code></pre>
