I am developing am application in that,i have one requirement i.e when there is incoming call corresponding method is called.I write alertview code,its works perfectly and shows alertview.
Alertview contains two button accept and reject ,when i click any of these buttons alertview delegate methods are not called.
+ (void)incomingCallAlertView:(NSString *)string
{
UIAlertView *callAlertView=[[UIAlertView alloc] initWithTitle:string message:@"" delegate:self cancelButtonTitle:@"reject" otherButtonTitles:@"accept",nil];
[callAlertView show];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSLog(@"clickedButtonAtIndex");
if(buttonIndex==0)
{
NSLog(@"buttonindex 0");
}
else
{
NSLog(@"buttonindex 1");
}
}
I am calling the +(void)incomingcall
method from another method using main thread.
- (void)showIncomingcalling
{
[CallingViewController performSelectorOnMainThread:@selector(incomingCallAlertView:) withObject:@"on_incoming_call" waitUntilDone:YES];
}
I write protocol in class ie <UIAlertViewDelegate>
but the delegate methods are not called can any one solve my problem thanks in advance.